I have a long dataframe with these columns in this format: id gender size region_a_count region_b_count item_group x m x x x x x
Solution 1:
I believe you need set_index
with unstack
:
df1 = df.set_index(["item_group","size", "id","gender"]).unstack()
Post a Comment for "Pandas Re-indexing With Multiindex On Index AND Columns"