Categories
Python Answers

How to Format or Suppress Scientific Notation from Python Pandas Aggregation Results?

Spread the love

Sometimes, we want to format or suppress scientific notation from Python Pandas aggregation results, we call set_option to change how numbers are formatted.

In this article, we’ll look at how to format or suppress scientific notation from Python Pandas aggregation results, we call set_option to change how numbers are formatted.

How to Format or Suppress Scientific Notation from Python Pandas Aggregation Results?

To format or suppress scientific notation from Python Pandas aggregation results, we call set_option to change how numbers are formatted.

For instance, we write

pd.set_option('display.float_format', lambda x: '%.3f' % x)

to set the 'display.float_format' option by calling set_option with 'display.float_format' and a lambda function to return the number x formatted our way with a format string.

Conclusion

To format or suppress scientific notation from Python Pandas aggregation results, we call set_option to change how numbers are formatted.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *