Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
In my job, we use a lot of Pandas (though not always very professionally). One very useful case is to build a dataframe conatining data from several instruments for several items. I tend to use a lot of multi-indexing columns.
In order to view (and modify) the columns, we like to save the dataframe in an Excel file, look at the data and possibly manually modify some values.
But with a lot of columns (espcially mult-indexed) we tend to have very big Excel files, that are not as readable as they should be. That is why I like to group some columns and enable the possibility to collapse them (and un-collapse them if I want to look at them).
I did not find a way to do it in Pandas ; but there it is possible in xlsxwriter. So I developed a short solution to automatically group all columns from the same multiindex column.
If you guys think it is interesting to add the option to Pandas I'd be happy to try to let my work be useful to others -I could try to add it to Pandas though I'm new to GitHub. What do you guys think? Feel free to say no :)
Below is a toy example, and attached are the non-grouped and the grouped columns Excel sheets.
Please don't be mad at the code, it's really quick&dirty way.
Dear all,
In my job, we use a lot of Pandas (though not always very professionally). One very useful case is to build a dataframe conatining data from several instruments for several items. I tend to use a lot of multi-indexing columns. In order to view (and modify) the columns, we like to save the dataframe in an Excel file, look at the data and possibly manually modify some values.
But with a lot of columns (espcially mult-indexed) we tend to have very big Excel files, that are not as readable as they should be. That is why I like to group some columns and enable the possibility to collapse them (and un-collapse them if I want to look at them).
I did not find a way to do it in Pandas ; but there it is possible in xlsxwriter. So I developed a short solution to automatically group all columns from the same multiindex column. If you guys think it is interesting to add the option to Pandas I'd be happy to try to let my work be useful to others -I could try to add it to Pandas though I'm new to GitHub. What do you guys think? Feel free to say no :)
Below is a toy example, and attached are the non-grouped and the grouped columns Excel sheets. Please don't be mad at the code, it's really quick&dirty way.
Code Sample, a copy-pastable example if possible
output_collapsed.xlsx output_no_collapse.xlsx