I am trying to transform the following dataframe
df = pd.DataFrame ({'ID' : [125,125,130,130,130],
'X' : [2,1,2,1,3]})
df
ID X
125 2
125 1
130 2
130 1
130 3
With new columns with the following criteria (this df is an example of my hole dataset just to illustrate my problem):
Add a new column for each duplicate id containing the value of X
df
ID X X_1 X_2
125 2 1 NaN
130 2 1 3