我在我的项目中为一堆不同的模块设置了以下选项:
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)
是否有全局设置?
是否有实现此目的的最佳方法,或者只为每个文件设置它们是否很常见?
请您参考如下方法:
这是引用自Options and Settings Python 文档。
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/startupMore 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)
