Pandas And NumPy Default Width Change On Startup
Is there a way to specify Pandas and NumPy display width on startup of an IPython shell. For example, # Run this at startup import numpy as np np.set_printoptions(linewidth=200) i
Solution 1:
For Windows, for me, I have a startup directory:
'C:\Users\username\.ipython\profile_default\startup'
In this I create a file:
'00-script.py`
Files in this directory will be run in alphabetical order by name. I put '00' in front to ensure it gets run first. In this file, you'd put:
import numpy as np
np.set_printoptions(linewidth=200)
import pandas as pd
pd.options.display.width = 200
Check documentation to see where your directory is.
Solution 2:
Just to add to the answer by @piRSquared, on Unix-based systems, you can do it by putting a startup script in ~/.ipython/profile_default/startup
:
$ cat ~/.ipython/profile_default/startup/load_pdnp.py
import pandas as pd
import numpy as np
pd.options.display.width = 200
np.set_printoptions(linewidth=200)
Or ~/.ipython/profile_<name>/startup
for a specific profile.
This has a side effect that pd
and np
would be now available to you in the IPython shell.
Post a Comment for "Pandas And NumPy Default Width Change On Startup"