0

I have this table that shows edit, upload and move rights for a page and also along with each right 3 other properties like Cascade, Expiry and Permissions. enter image description here

Now I want to change multiple entries into a single row such that it has columns like Edit_Permissions, Move_Permissions, Upload_Permissions, Edit_Cascade, Move_Cascade, Upload_Cascade, Edit_Expiry, Move_Expiry, Upload_Expiry (I want a flattened column classification) but when I used pivot feature of Pandas, the new dataframe shows multiple hierarchical column classification) enter image description here

Is there any way I can get columns in a flattened manner, just like this: enter image description here

Please note the resultant dataframe is not a Multi index column dataframe, I checked using this piece of code: enter image description here

  • Please see this post: https://stackoverflow.com/questions/14507794/pandas-how-to-flatten-a-hierarchical-index-in-columns – annicheez Oct 22 '20 at 09:59
  • @annicheez the post you referred suggest solution for Multi index column dataframe, my dataframe is not multi-index (it seems hierarchical due to pivoting), I have edited the question – Sidrah Madiha Siddiqui Oct 22 '20 at 10:00

0 Answers0