Reading an excel with pandas basing on columns' colors

前端 未结 2 825
一整个雨季
一整个雨季 2020-12-17 03:55

I have an xlsx file, with columns with various coloring.

I want to read only the white columns of this excel in python using pandas, but I have no clues on hot to d

2条回答
  •  独厮守ぢ
    2020-12-17 04:41

    This can not be done in pandas. You will need to use other library to read the xlsx file and determine what columns are white. I'd suggest using openpyxl library.

    Then your script will follow this steps:

    1. Open xlsx file
    2. Read and filter the data (you can access the cell color) and save the results
    3. Create pandas dataframe

    Edit: Switched xlrd to openpyxl as xlrd is no longer actively maintained

提交回复
热议问题