python - 在 Jupyter 中使用 Pandas 自动完成的问题
问题描述
我遇到了与此用户类似的问题:在调用自动完成时df.col.
,即使在评估仅包含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]
我不想尝试腹地,因为我只想在按下选项卡时自动完成。
提前非常感谢!
解决方案
阅读此内容后,似乎其他人以及特定版本的 ipython 都面临此问题。该链接上也给出了解决方案。
它是这样的:
从终端运行以下命令:
ipython profile create
它将在~/.ipython/profile_default/ipython_config.py
现在编辑它ipython_config.py
并添加以下行,它将解决问题。
c = get_config()
c.Completer.use_jedi = False
参考:
推荐阅读
- swift5 - 如何在 Regex iOS Swift 中添加汉字?
- laravel - “DataTables”命名空间中没有定义命令
- flutter - 当txt在毫秒内保持打开和关闭时如何避免文本文件出错
- javascript - 如何从 React 中的嵌套对象数组中提取数据?
- linux - Docker 容器命名在本地机器上更改为 hypens
- python - 检查点 (x1,y1) 是否位于两条平行线之间
- next.js - Next Js 主页在 Next JS 升级到 Next JS 11.1.2 后给我 404 Page not found
- visual-studio - 我可以强制 Visual Studio 不使用特定的第 3 方库吗?
- python - 为什么 Python 在尝试强制转换时认为我正在创建一个变量?
- java - RestAssured 自定义 TLS 版本