pandas.set_eng_float_format#
- pandas.set_eng_float_format(accuracy=3, use_eng_prefix=False)[source]#
Format float representation in DataFrame with SI notation.
Deprecated since version 3.1.0: Use
pd.set_option("display.precision", N)to control decimal precision, or pass a custom callable topd.set_option("display.float_format", func).Sets the floating-point display format for
DataFrameobjects using engineering notation (SI units), allowing easier readability of values across wide ranges.- Parameters:
- accuracyint, default 3
Number of decimal digits after the floating point.
- use_eng_prefixbool, default False
Whether to represent a value with SI prefixes.
- Returns:
- None
This method does not return a value. it updates the global display format for floats in DataFrames.
See also
set_optionSet the value of the specified option or options.
reset_optionReset one or more options to their default value.
Examples
Use
pd.set_option("display.precision", N)to control decimal precision instead:>>> with pd.option_context("display.precision", 3): ... print(pd.DataFrame([1e-9, 1e-3, 1, 1e3, 1e6])) 0 0 1.000e-09 1 1.000e-03 2 1.000e+00 3 1.000e+03 4 1.000e+06