I’ve the following dataframe:
month name product category Metric Flipkart Active
0 April Accessories Stock Quantity NaN 1808.00
1 April Accessories Stock Quantity 0.0 NaN
2 May Accessories Sales Quantity NaN 61.00
3 May Accessories Sales Quantity 0.0 NaN
4 April Anklet Stock Quantity NaN 21861.75
I’d like to convert it into this:
How do I achieve this? It has to be generic enough for when multiple rows need to be switched to columns. The column names to be switched will be available in a list.Doesn’t necessarily have to be with pandas. I’m open to using other libraries as well.