Jupy中Pandas的自动完成问题

2024-05-12 12:05:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我遇到了一个问题similar to this user:当对df.col.调用autocomplete时,即使对只包含df.col的单元格求值,我也得不到自动完成。例如,我希望看到df.col.str.matc自动完成到df.col.str.match。我能做些什么来解决这个问题?在

以以下数据帧为例:

import pandas as pd
data = [['Alex in FL','ten'],['Bob in FLORIDA','five'],['Will in GA','three']]
df = pd.DataFrame(data,columns=['Name','Age'])

#Dataframe:
    Name             Age
0   Alex in FL       ten
1   Bob in FLORIDA   five
2   Will in GA       three

#Command that should autocomplete (but does not):
df.Name.str.matc [+TAB]

我不想尝试hinterland,因为我只想在按tab键时自动完成。在

提前谢谢你!在


Tags: nameindfdatacolautocompletepdbob
1条回答
网友
1楼 · 发布于 2024-05-12 12:05:44

在阅读了this之后,这个问题似乎是其他人和ipython的特定版本所面临的。在这个环节上也给出了解决方案。在

是这样的:

从终端运行以下命令:

ipython profile create

它将在~/.ipython/profile_default/ipython_config.py处创建一个默认配置文件

现在编辑这个ipython_config.py,并添加下面的行,它将解决这个问题。在

^{pr2}$

参考文献:

  1. https://github.com/jupyter/notebook/issues/2435
  2. https://ipython.readthedocs.io/en/stable/config/intro.html

相关问题 更多 >