-
-
Notifications
You must be signed in to change notification settings - Fork 19.7k
Description
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:
- GitHub code search yields ~30 results for
set_eng_float_formatoutside pandas-dev/pandas. The vast majority are vendored copies of pandas, type stubs, or re-exports (xorbits, modin, Apache Beam, pyparallel, pandas-stubs, etc.). Only 2 results are actual user code calling this function. - Stack Overflow has zero questions or answers mentioning
set_eng_float_format. - Only 2 bug reports have ever been filed against this function in the pandas issue tracker (interation of set_eng_float_format and pivot_tables #11981 in 2016, Make pd.set_eng_float_format() into proper pandas.options.display option #15610 in 2017).
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.