AutoComplete in ipython with pandas Seems to be broken

我怕爱的太早我们不能终老 提交于 2020-01-02 17:56:31

问题


I have a pandas dataframe named frame

I want to invoke the frame[SomeCoulmnname].value_counts() method

The issue is that ipython doesnt autocomplete even after i type v after the . In fact it doesnt even return any suggestions.

But if i simply type Series. and press the tab it return me the possible methods that i am looking for.

My question is why is iPython behaving like this?The same work with PyCharm though!

Any help on this will be greatly appreciated.Thanks


回答1:


This isn't specific to pandas.

IPython cannot know/guess the type of the object returned by running frame[SomeCoulmnname] without actually running it. Since it also cannot assume running it is safe/fast/etc, it doesn't run it.

Since it doesn't know the type of the object, it can't suggest completions for it.

Series.<TAB> works because no guessing is required. IPython knows that Series is a type, hence it can resolve its members.

A solution would be to assign the temporary value to a variable:

s = frame[SomeCoulmnname]
s.v<TAB>


来源:https://stackoverflow.com/questions/30016101/autocomplete-in-ipython-with-pandas-seems-to-be-broken

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!