2

I have 0.20.3 version of pandas install. I am trying to set header_style to false so that i can format the header row. xlsxwriter not applying format to header row of dataframe - Python Pandas

I keep getting error : AttributeError: 'module' object has no attribute 'formats'

I have tried

pd.formats.format.header_style = None 

and

pd.core.format.header_style = None

Any idea what am I doing wrong ?

enter image description here

ProgSky
  • 2,530
  • 8
  • 39
  • 65

2 Answers2

3

As you can see in the API, the module pandas.formats and pandas.core.format do not exist : https://pandas.pydata.org/pandas-docs/stable/api.html It is normal that you have this error.

If you read new API changes with 0.20, pandas.formats has become pandas.io.formats. Try to check the API.

Adrien Logut
  • 812
  • 5
  • 13
1

Another way to do this, suggested by @Martin Evans, is to write the headers directly, outside of Pandas. This avoids issues like above with different Pandas versions.

See also this example in the XlsxWriter docs.

jmcnamara
  • 38,196
  • 6
  • 90
  • 108