Display 2 decimal places, and use commas to separate thousands, in Jupyter/pandas? Display 2 decimal places, and use commas to separate thousands, in Jupyter/pandas? pandas pandas

Display 2 decimal places, and use commas to separate thousands, in Jupyter/pandas?


Configure the following option in any cell:

pandas.options.display.float_format = '{:,.2f}'.format

You can also format the output for any float throughout the notebook with this magic command:

%precision %.2f


You can set the display.precision option with e.g.:

pd.set_option('precision', 7)

when you are done, reset it back using

pd.reset_option('precision')

as documented in https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html