Home > Mobile >  Unhide columns in an Excel sheet with pandas and output into a dataframe
Unhide columns in an Excel sheet with pandas and output into a dataframe

Time:12-12

I am having an excel workbook with a sheet containing some pivoted data. Since the data is in a tabular format, I am able to read it into a dataframe. However, the pandas.read_excel() is able to read only those columns that are present in the pivot table. I would also want to read/unhide/select the columns that are no part of the pivot table yet. Is there a way by which I can do this in pandas or any utility in Python?

pandas.melt() doesn't seem to be able to help here. Attaching a snip below.

enter image description here

CodePudding user response:

I'd suggest importing the source data (ie the source range for the pivot) and doing the pivot and aggregations in pandas so you have access to full data set that you need.

CodePudding user response:

not enough rep to comment ; is the source data of the pivot contained in the same workbook? i would read that instead.

  • Related