我在〜/ .ipython / profile_default / startup位置具有以下启动:
import sys, os
sys.path.append(os.environ["PYTHONPATH"])
import pandas as pd
pd.set_option("display.max_columns", 999)
pd.set_option("display.max_rows", 999)
pd.set_option("precision", 5)
现在由于某种原因,PYTHONPATH可以正常工作,但pandas的显示选项却无法正常工作。您有什么建议我尝试解决此问题?
您可以将以下内容放入~/.ipython/profile_default/ipython_config.py
文件中。在命令行中启动Notebook时,它将自动执行ipython notebook
。我发现一些有用的选项:
# Configuration file for ipython.
c = get_config()
c.InteractiveShellApp.exec_lines = [
'from __future__ import print_function, division',
'%matplotlib inline',
'import sys, os',
'sys.path.append(os.environ[\'PYTHONPATH\'])',
'os.chdir(\'path/to/your/working/dir\')',
'import pandas as pd',
'import numpy as np',
'pd.options.display.notebook_repr_html = False',
'pd.options.display.max_rows = 20',
'pd.options.display.max_columns = 20',
'pd.options.display.expand_frame_repr = False',
'pd.options.display.max_colwidth = 28',
'pd.options.display.precision = 5',
'np.set_printoptions(precision=4, linewidth=90, threshold=25)',
'import datetime as dt',
'import matplotlib.pyplot as plt'
]
c.NotebookApp.notebook_dir = u'path/to/your/notebook/dir'
c.IPythonWidget.font_size = 12
c.IPythonWidget.font_family = "Ubuntu Mono"
c.ZMQInteractiveShell.colors = "LightBG"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句