Pandas Set_option - More Than One Option Per Line
This may be a stupid question, but.... when setting options after importing pandas I set them one at a time such as: pd.set_option('max_rows',1000) pd.set_option('notebook_repr_htm
Solution 1:
There isn't a native way to do multiple options on one line. I guess you could do something like:
[pd.set_option(option, setting) for option, setting in [('max_rows', 1000), ('notebook_repr_html', False)]]
but I wouldn't recommend doing that!
I think writing this longhand is easier to read, more concise, and more pythonic:
pd.set_option('max_rows',1000)
pd.set_option('notebook_repr_html',False)
Solution 2:
[A couple of years later to the party....]
I know it is an old question, but I found myself often searching for this.
This is my solution based on Andy Hayden solution above. A little bit more readable and uses python 3.X dict.
pd_options = {
'display.max_rows' : 500,
'display.max_columns' : 500,
'display.width' : 1000,
}
[pd.set_option(option, setting) for option, setting in pd_options.items()]
Post a Comment for "Pandas Set_option - More Than One Option Per Line"