Skip to content

DEPR: deprecate set_eng_float_format #64460

@jbrockmendel

Description

@jbrockmendel

Claude wrote this at my request.

Proposal

Deprecate pd.set_eng_float_format() in favor of using pd.set_option("display.float_format", EngFormatter(...)) directly.

Human Update Or just deprecate without an alternative. I haven't seen any evidence that anyone uses this.

Rationale

set_eng_float_format is a legacy convenience function (added in v0.5.0) that is a thin wrapper around set_option:

def set_eng_float_format(accuracy=3, use_eng_prefix=False):
    set_option("display.float_format", EngFormatter(accuracy, use_eng_prefix))

It is the only top-level pd.set_* function that exists outside the options API, making it an odd outlier in the public API. This was already identified in #15610, where the consensus was to integrate this into the options machinery or deprecate it.

Evidence of minimal usage:

The replacement is straightforward and equally concise:

# Before
pd.set_eng_float_format(accuracy=3, use_eng_prefix=True)

# After
from pandas.io.formats.format import EngFormatter
pd.set_option("display.float_format", EngFormatter(accuracy=3, use_eng_prefix=True))

This keeps EngFormatter available (it is not being deprecated), removes a one-off top-level function that doesn't fit the options API pattern, and simplifies the public API surface.

Closes #15610.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeprecateFunctionality to remove in pandasNeeds DiscussionRequires discussion from core team before further actionOutput-Formatting__repr__ of pandas objects, to_string

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions