No autocomplete for pandas column name in Jupyter notebook using bracket notation ['col']
See original GitHub issueEnvironment data
- VS Code version: 1.64.00
- Jupyter Extension version (available under the Extensions sidebar): v2022.1.1001821375
- Python Extension version (available under the Extensions sidebar): v2022.0.1814523869
- OS (Windows | Mac | Linux distro) and version: Windows 10
- Python and/or Anaconda version: python 3.8.12
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
- Jupyter server running: Local
Expected behaviour
Autocomplete works for pandas dataframes in jupyter notebooks.
Actual behaviour
Autocomplete does not work. Users have to manually type the column names every time. It even doesn’t work when I’ve manually specified the column name several times. I’ve tried all the language servers, including Jedi, Pylance, and the default option. No autocomplete.
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
- Create pandas dataframe
df = pd.DataFrame({'test': [1,2], 'test2': [2,3]})
- Call dataframe variable and check if autocomplete works for the columns
df['test']
Logs
Output for Jupyter
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Jupyter
)
XXX
Issue Analytics
- State:
- Created 2 years ago
- Comments:25 (16 by maintainers)
Top Results From Across the Web
Use the brackets to select a single pandas DataFrame column ...
Use the brackets to select a single column from a pandas DataFrame and not dot notation. It is a single method that works...
Read more >Problem with autocompletion with Pandas in Jupyter
if col contains string values like 'abc', 'def' or in other words, it's type is object, then df.col.str.mat + tab will work. But...
Read more >How to enable auto-completion in Jupyter Notebook
Simply hit the “Tab” key while writing code. This will open a menu with suggestions.
Read more >Should you use "dot notation" or "bracket notation" with pandas?
There are two ways to select a Series from a DataFrame: "dot notation" and "bracket notation" (square brackets). Find out which one you ......
Read more >Autocomplete dataframe columns names not working in jupyter
Hi there, julia newbie here, switching from python :). I am using jupyter and dataframe package. Please, is there a way how to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can get completions to work in a jupyter notebook (outside of VS code) and it does support the
df.['column_name']
syntax:(Jupyter brings up completions on the ‘tab’ key)
So it would seem like we could implement this.
Not super happy with this. Jupyter completions suck.
This is the result I get if I ‘fix’ this and put it back how it was:
As you can see it’s listing out every possible match for the letter ‘a’. Not just columns. Jupyter isn’t filtering anything.
Jupyter notebook is more precise though. It gives me this:
And the difference is in our use of Jedi. We disable this because of perf problems with Jedi in a kernel. If I reenable it, our completions come out the same as Jupyter
(after typing a)
I’m going to add a setting to enable more precise intellisense. With a warning that this makes everything potentially slower.