How can I transfer two column features into pivot table on the following dataset
I have tried the aggfunc function but this fill the value either 0 or 1. I want to transfer the row as cell value.
Here is the dataset
content Users
22 1196
23 1196
23 1216
16 880
20 880
20 1224
22 1245
23 1122
22 872
I want to transfer this dataset into this
Users 1 2
1196 22 23
1216 23 NaN
880 16 20
1224 20 NaN
1245 22 NaN
1122 23 NaN
872 22 NaN
I have tried it by using
df.pivot_table(index=["city"], columns="cuisine", aggfunc=lambda x: 1, fill_value=0)
df.pivot_table(index=["users"], columns="content", aggfunc=lambda x: 1, fill_value=0)
But this fills the values either 0 or 1