Skip to content Skip to sidebar Skip to footer

Pandas Raising: Attributeerror: Module 'pandas.core' Has No Attribute 'format'

I get the following error when running pd.core.format.header_style = None: AttributeError Traceback (most recent call last)

Solution 1:

You're now looking for

pd.formats.format.header_style = None

I believe, as of version 0.18.1. See the issue CLN & REORG core/common.py #12503.


Edit (version >= 0.20)

As mentioned by Jeff, this is not a public property and so is prone to move around. Now it is found in pandas.io.formats.excel, which you'll have to import.

If you wanted to handle accessing it from different versions thus far (again, susceptible to change), an adaptation from this incompatibility issue might look something like

import packaging.version
import pandas
import pandas.io.formats.excel

defget_format_module():
    version = packaging.version.parse(pandas.__version__)
    if version < packaging.version.parse('0.18'):
        return pandas.core.formatelif version < packaging.version.parse('0.20'):
        return pandas.formats.formatelse:
        return pandas.io.formats.excel.ExcelFormatter

Post a Comment for "Pandas Raising: Attributeerror: Module 'pandas.core' Has No Attribute 'format'"