PyChram autocomplete for import library

已回答

 if I write the code below in python file(.py).

import numpy as np
import pandas as pd

test_df = pd.read_csv('testdata/testdata.csv')

and if i type 'pd.' or 'test_df.' and press ctrl+space button, anything show up.

I could I fix it?

 

5
Avatar
Permanently deleted user

Yeah. I check it already.

In the python code script isn't work

But in the console mode, it works

0

There is a yellow warning that no interpreter is configured. Add interpreter  in "Settings | Project | project Interpreter".

0
Avatar
Permanently deleted user

I added it. 

However, autocomplete still not works.

 

0

Have you tried to run "File | Invalidate caches"?

1

i am also having same trouble for other modules.

0

Hi Csai,

What kind of trouble? Screenshots are welcome.

0

Auto complete suggestion are coming on the console but not in the editor as mentioned by cjse3178

0

Do you use conda?

Try File | Invalidate Caches/Restart... to make PyCharm reindex your interpreter.

0

No i do not use conda
And i also tried File | Invalidate Caches/Restart but it didn't work

0

Please attach a screenshot of your Project Interpreter and another one which shows the problem in editor.

0

its not working in the editor.

 

only working in the python console.

0

how can i fix it..??

0

Which package is it specifically? Would be great to see the whole script.

Also, what about Project Interpreter? Could you attach a screenshot of it?

0

 

 

0

I believe this is due to the fact that it is imported dynamically and PyCharm doesn't introspect it that deep while in Python Console the line is already executed and dynamic import is already performed.

Not sure if we can support such case, but feel free to submit a feature request about it to our issue tracker using the link https://youtrack.jetbrains.com/issues/PY

0

HI,

I am Using Pycharm professional, and I am facing same problem. I do appreciate your help and support

Regards,

Mohamed Alshishani

0

I'm having the exact same issue with no code completion suggestions for unittest.

Have tried File | Invalidate Caches/Restart as well

0

I have the same problem, even though I'm able to run my code locally with the remote interpreter...any ideas?

0

Some suggestions:

1. Try File > Invalidate caches / restart

2. Make sure power save mode is off

3. Try to delete / recreate the interpreter. If using SSH interpreter, delete ~/.pycharm_helpers from remote host as well.

0

I'm having a very similar issue. Pandas was autocompleting basic things like pandas.DataFrame.columns, pandas.DataFrame.index, now it's not finding any of those but some internal private methods.

I've followed the steps, Andrey as provided. No improvement. Not sure how to fix.

0

@...

Please provide a working snippet of the code where completion isn't working.

0

Andrey Resler

Here's very simple code, using a fresh Conda python 3.75 environment with only pandas and numpy installed:

import pandas as pd
import numpy as np


class Car(object):
wheels = 4
doors = 2
engine = "4 cyl ICE"


if __name__ == "__main__":
df1 = pd.DataFrame(np.random.randn(5,3), columns=['hickory', 'dickory', 'dock'], index=['alpha', 'beta', 'charlie', 'delta', 'edward'])
print(df1.index)
print(df1.columns)

c1 = Car()
print(c1.wheels)


See screen grabs of trying to autocomplete. Basically, none of the properties or fields are getting proposed in the Autocomplete.

Here `pandas.DataFrame.index` is not being proposed...

Here `pandas.DataFrame.columns` isn't being proposed.

However a non-imported class works:

This all used to work only a few updates back... I'm not sure what changed, but it's kind of crappy when VS Code can do this for "free" and my paid JetBrains tool cannot.

0

This happens to me with other libraries that aren't pandas. Further more, PY-28459 seems to be more of a feature request, while this issue, as indicated by several reports from other users over the last few months, is not a feature request, but rather a request to fix a bug, that I would consider pretty major, given that code completion is something pretty fundamental to this tool.

Andrey, I wouldn't want this to be treated as a feature request, as we're not asking for a feature, we're asking for a basic component of the IDE to be fixed.

3

David,

Could you please submit a bug report to https://youtrack.jetbrains.com/issues . and provide:

- Code sample and steps to reproduce the issue

- Logs: https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files

0

I provided everything that’s needed above. As an ALL TOOLS Subscriber, it’s really frustrating when a commercial tool doesn’t do what even the most basic FREE IDE’s do, and the developer just pushes it off as a “feature request” instead of a bug.

This is not the first time Jet Brains has tried to redirect what is clearly a bug as a feature request. Makes me wonder why I continue the subscription.

4

"This is not the first time Jet Brains has tried to redirect what is clearly a bug as a feature request. Makes me wonder why I continue the subscription."  So true, after several years subscribing, I have decided I will no longer continue. JetBrains seems to prefer function bloat over fixing what should have worked in the first place. MS Studio Code, here I come...

3

Jim,

The snippet you provided is about pandas dataframes, right? As I mentioned, there's a known issue for that: https://youtrack.jetbrains.com/issue/PY-28459

By the way, this issue is registered as bug, not feature request. And yes, I agree it's pretty essential and should be fixed.

UPD: I just noticed it was changed from feature request to bug by our QA engineer, so kudos to him.

 

Then, David mentioned that he has similar issues with other packages, without mentioning which packages exactly (maybe those issues are already known). Actually, we have many unique package-specific issues in our bug tracker. What's more, investigating complex issues like that in forum thread is counter-productive, so I believe it's much more effective to submit an issue. If it's known, we'll mark it as duplicate, if it's a new issue - we'll investigate and assign priority.

I didn't mean to cause any frustration.

0

Andrey Resler,

I appreciate you following up here, however if the idea for hashing out problems is through the issue tracker, the issue tracker should be more predominant in the support context.  In fact if I go to the main support page, nowhere can I find a link to the https://youtrack.jetbrains.com site to either search or submit issues. There's only this community forum.

0

Maybe we're looking at different support pages :)

If you go here: https://intellij-support.jetbrains.com/hc/en-us/?pycharm

You should see issue tracker as the first in the list, followed by "submit request", which creates a support ticket in our help desk.

0

请先登录再写评论。