spyder autocomplete not finishing dataframe column names

Created on 19 Mar 2020  路  15Comments  路  Source: spyder-ide/spyder

Hey all,

Using Spyder 4.1.1 and python 3.7 here and the auto complete cannot finish column names in pandas dataframes.

I have a data frame with the column 'waveform_id' and when I run the following:

import pandas as pd
data = pd.read_csv('my_data.csv')

and then try to use the autocomplete to finish:
data['wav
it comes up with everything OTHER than the column name.

Any fixes?

Awaiting Followup

Most helpful comment

Kite currently handles DataFrame in the same way as dict. We observe column accesses, and use that information to provide completions. That means we can't provide completion for data loaded dynamically from disk (json or csv for example) until you access/write to columns in this dataframe.

After using the object a bit more, Kite should be able to subsequently provide completions based on your usage.

All 15 comments

Is this something that should be working at the moment @andfoy , @ccordoba12 ?

it comes up with everything OTHER than the column name.

What do you mean by this @Travis-Barton?

He means that the completions options (the fallback ones) appear and in those there is no sign of the dataframe columns

Hey @ccordoba12, @goanpeca has it exactly right. It gives me loads of things like 'Arithmetic error' but no column names of any kind.
I'll try to be more concise in the future.

Works for me:

Selecci贸n_018

It gives me loads of things like 'Arithmetic error' but no column names of any kind.

If you still get that, then you're not using 4.1.1. I spent a lot of time fixing it.

My recommendation is to create a new conda env and install 4.1.1 there. In any case, there's nothing for us to do here, so I'm closing this one.

Works for me:

Selecci贸n_018

It gives me loads of things like 'Arithmetic error' but no column names of any kind.

If you still get that, then you're not using 4.1.1. I spent a lot of time fixing it.

My recommendation is to create a new conda env and install 4.1.1 there. In any case, there's nothing for us to do here, so I'm closing this one.

That works for me too if I explicitly have the word 'bar' in the script somewhere. But that won't work if you load a csv and just ask it to complete the column name. I am running 4.1.1.

I rarely have the column name explicitly written in my code on the first use, as I load data from SQL servers often. Please do not close this, it is a rather important feature.

That works for me too if I explicitly have the word 'bar' in the script somewhere.

Sorry, I totally missed that! Then, this is a missing functionality in Jedi, the code completion library we depend on, so (still) there's nothing we can do about it, sorry.

However, Kite can give completions for dict keys, so maybe it can complete Pandas column names too.

However, Kite can give completions for dict keys, so maybe it can complete Pandas column names too.

Gotcha! Thanks!

Is that something I can do from spyder's settings? Or is that something I can possibly do from kite?

It should work by default once you've installed Kite. To install Kite from Spyder, you can go to the Tools menu and select the entry for it.

I have it installed and running, it must not be able to /: unless I have some settings configured weird.

Screen Shot 2020-03-24 at 11 44 22 AM

You should see a Kite: ready message in the status bar, if everything is working fine.

I have that, but still no luck, oh well!

@metalogical, does Kite support completion of Pandas column names? Or do you plan to add it in the future?

Kite currently handles DataFrame in the same way as dict. We observe column accesses, and use that information to provide completions. That means we can't provide completion for data loaded dynamically from disk (json or csv for example) until you access/write to columns in this dataframe.

After using the object a bit more, Kite should be able to subsequently provide completions based on your usage.

Thanks for the explanation @metalogical!

Was this page helpful?
0 / 5 - 0 ratings