简体   繁体   中英

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

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.

在此处输入图像描述

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM