问题
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