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

0

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

that's perfect!
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.

1 Comment

Great. Thanks for the link. I will try it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.