Last active
February 12, 2021 14:51
-
-
Save data-enhanced/0c48586f36e8cd27ffad8fe076d62c4e to your computer and use it in GitHub Desktop.
Format output of pandas describe() method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Describe() formatted | |
| # Format numbers without scientific notation and with thousands separators | |
| # To change the number of decimals, change the number before the f | |
| # To remove the thousands separator remove the comma | |
| # See https://stackoverflow.com/a/47207283 | |
| # See also https://mkaz.blog/code/python-string-format-cookbook/ | |
| df.describe().apply(lambda s: s.apply('{:,.0f}'.format)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment