11

After importing Pandas, when creating a pandas dataframe, Intellisense doesn't show the available attributes/methods of the created object.(Image 2, where I try to use the .head() function).

It detects the module pd(pandas) methods without any problem (see Image 1).

I don't have this problem when running a Jupyter Notebook or Jupyter Lab on the browser.

I'm using:

  • Windows 7
  • Python 3.8.3 in a Conda environment.
  • VSCODE 1.46.1
  • Python extension 2020.6.90262
  • Microsoft Language Server
  • Visual Studio Intellicode 1.2.8

IMAGE 1: It uses intellisense to detect the module methods/attributes

IMAGE 1:It uses intellisense to detect the module methods

IMAGE 2: Intellisense doesn't show the pandas object available attributes/methods

IMAGE 2:Intellisense doesn't show the pandas object available attributes

3 Answers 3

9

The detection isn't working because IntelliSense has a hard time with pandas (and pandas.read_csv() especially). It works in Jupyter because it's accessing the live data while IntelliSense has to infer everything from the source code statically.

I would advise trying out Pylance as it's the new language server from Microsoft and we have tried to support pandas appropriately. If Pylance doesn't work then try different values for your python.languageServer setting and see which one gives you the best result.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks! Installing Pylance did the trick and now it works with Pylance as the language server.
Does working with VScode remote via SSH invite more such problems? Or can I expect the language server to work remotely as it does locally?
Using the remote extensions means everything runs on the remote server with the code, including the other extensions. That means Pylance will run on the remote machine and so there shouldn't be any unique issues due to using the SSH remote extension.
0

Go to your VS Code explorer and open that folder you are currently working in. This should solve the problem. Or go to file-> Open Folder. You can also open your current working folder by hotkey ctrl + o .

2 Comments

Hi, it is not about finding the file (which I can find). It is about Intellisense not working in the Pandas object I successfully created (Dataframe).
@Episkiliski Yes some times VS Codes intellisense don't work without opening the file correctly. Because intellisense depends on the file location and code in that file to show us the code suggestion. I had same problem. I did use this method and it solved my issue.
0

Close but no cigar. In 2021, language servers still often break. I think VS code is a good idea but sometimes they just break things. I use Intellij for work and it is heavier but better in that regard. I'm sure they will get it right eventually but sadly i don't think they are taking it as serious as they should since data scientists are a big part of their costumers and if you create a pandas object you might be working with its methods for a while rather than direct methods off the modules! So it REALLY helps if we can access lets say pandas.DataFrame.groupby for example rather than just things directly after pandas alone. I keep using VS code as I like keeping my browser up and really enjoy the advantages of having an unified place to keep my python, R and notebook code :) We just need to be patient!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.