moto
moto

Reputation: 940

Set pandas options for entire project

I have the following options set for a bunch of different modules in my project:

pd.set_option('display.width', 300)
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.precision', 15)

Is there a global setting?

Is there a best way to achieve this or is it common to just set them for each file?

Upvotes: 3

Views: 377

Answers (1)

jpp
jpp

Reputation: 164773

This is quoted from Options and Settings Python documentation.

Setting Startup Options in python/ipython Environment

Using startup scripts for the python/ipython environment to import pandas and set options makes working with pandas more efficient. To do this, create a .py or .ipy script in the startup directory of the desired profile. An example where the startup folder is in a default ipython profile can be found at:

$IPYTHONDIR/profile_default/startup

More information can be found in the ipython documentation. An example startup script for pandas is displayed below:

import pandas as pd
pd.set_option('display.max_rows', 999)
pd.set_option('precision', 5)

Upvotes: 2

Related Questions