gpt4 book ai didi

python - 为整个项目设置 pandas 选项

转载 作者:太空宇宙 更新时间:2023-11-04 02:32:55 25 4
gpt4 key购买 nike

我在我的项目中为一堆不同的模块设置了以下选项:

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/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)

关于python - 为整个项目设置 pandas 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48727533/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com