在将 Pandas 数据帧传输到函数时,有没有办法让 ipython 自动完成?

问题描述

例如,如果我有一个管道函数

def process_data(weighting,period,threshold):
    # do stuff

我可以自动完成流程数据参数吗?

有很多参数需要记住,我想确保它们被正确传递。在 ipython 中,该函数可以自动完成以向我显示关键字 args,这非常简洁,但我希望它在管道 Pandas 数据帧时也能这样做!

enter image description here

enter image description here

我不知道这怎么可能,但话说回来,我真的很敬畏 ipython 及其所有伟大之处。那么,这可能吗?如果没有,人们是否还想出了其他黑客?

解决方法

安装 pyreadline 库。

$ pip install pyreadline

更新:

这个问题似乎是某些版本的 ipython 所特有的。解决方法如下: 从终端运行以下命令:

$ ipython profile create

它将在 ~/.ipython/profile_default/ipython_config.py

创建一个默认配置文件

现在编辑此 ipython_config.py 并添加以下行,它将解决问题。

c = get_config()
c.Completer.use_jedi = False

参考: