I have a DataFrame like
event entity type
1 T1 Table
1 C1 Cell
1 C2 Cell
2 T2 Table
2 C3 Cell
I want to convert it to something like this
event Table Cell
1 T1 C1
1 T1 C2
2 T2 C3
This is the output of pd.melt and drop_duplicates() and I read that melt's opposite is pivot so tried to approach that way for a single event.
df.pivot_table(values='entity', index='event', columns='type')
but this throws error as DataError: No numeric types to aggregate which is obvious because pivot does a group by aggregate and doesn't replicate every combination. Any idea what exactly this kind of operation might be done with? Please note the groupby thing which I discarded for simplification.