I've a dataset in this format:
df = pd.DataFrame({'ID': [1,2,3,4],
'Type': ['A', 'B', 'C', 'D'],
'Value': [100, 200, 201, 120]})
I want to replicate one of this dataframe more than once and add new ID which is incremental. So, the new dataset looks like the following:
df = pd.DataFrame({'ID': [1,2,3,4, 10, 11, 12, 13],
'Type': ['A', 'B', 'C', 'D', 'B', 'B', 'B', 'B'],
'Value': [100, 200, 201, 120, 200, 200, 200, 200]})
I could replicate the rows in the following way:
df_B = df[df['ID'] == 'B']
df_B = pd.concat([df_B]*4)
But I've trouble updating the ID column incrementally.
If someone can guide me.
Thanks!