Sos
Sos

Reputation: 1949

Problem with autocompletion with Pandas in Jupyter

I am having a problem similar to this user: when calling autocomplete on df.col., I get no autocompletion even after evaluating a cell containing only df.col. For instance, I'd like to see df.col.str.matc to autocomplete to df.col.str.match. What can I do to solve this?

Take as example the following dataframe:

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]

I do not want to try hinterland since I only want autocomplete upon pressing tab.

Thanks a lot in advance!

Upvotes: 7

Views: 2984

Answers (1)

vb_rises
vb_rises

Reputation: 1907

After reading this, it seems that this problem is faced by other people and with specific version of ipython. The solution is also given on that link.

It is like this:

Run below command from the terminal:

ipython profile create

It will create a default profile at ~/.ipython/profile_default/ipython_config.py

Now edit this ipython_config.py and add the below lines and it will solve the issue.

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

Reference:

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

Upvotes: 4

Related Questions