Whenever I try to access a non-method attribute of a Series or DataFrame (such as columns
or loc
), IntelliJ throws me an "unresolved reference" warning which doesn't crash my code, but is fairly annoying to see. I'd rather not disable this inspection, and I'd like to avoid peppering my code with suppressions.
I've set the "Collect run-time types information for code insight" option of the debugger, but this didn't work. I've also tried adding references to ignore in the "Ignore References" list in the Inspections tab, but nothing I tried seemed to work.
The warning I get will be something like Cannot find reference loc in 'Series | Series'
.
One thing that works for me when PyCharm's autocomplete is having trouble figuring out my variable type is type hinting. It happens rarely enough that I (thankfully) don't have to do it that often.
df = pd.DataFrame() # type: pd.DataFrame
More info on typing can be found here: What are Type hints in Python 3.5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With