Created
November 24, 2020 19:51
-
-
Save joefromct/58c5e85cd1b06d89a1414b26c64ea288 to your computer and use it in GitHub Desktop.
pandas set_options.py
This file contains 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
import pandas as pd | |
def set_options(*seq): | |
"https://toolz.readthedocs.io/en/latest/_modules/toolz/itertoolz.html#partition" | |
assert len(seq) % 2 == 0, "I need pairs of option/values?" | |
options = [iter(seq)] * 2 | |
for opt, val in list(zip(*options)): | |
pd.set_option(opt, val) | |
print(f"{opt} -> {val}") | |
set_options("display.float.format" , '{:,.2f}'.format , | |
"display.max_colwidth" , None , | |
"display.max.columns" , None , | |
"display.precision" , 2) | |
# display.float.format -> <built-in method format of str object at 0x7fc6fc8d57b0> | |
# display.max_colwidth -> None | |
# display.max.columns -> None | |
# display.precision -> 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment