Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pylint complain if we use pandas class instances

Tags:

python

pylint

pylint complain about pandas class instances::

I have db instance that has data (a panda Dataframe) as instance.

If I call e.g. iloc or shape on it::

cols = db.data.shape
xxx = db.data.iloc[1:4, 0:9]

pylint complain about::

E: 36,18: Instance of 'TextFileReader' has no 'iloc' member (no-member)
E: 92,30: Instance of 'TextFileReader' has no 'shape' member (no-member)
E: 92,30: Instance of 'tuple' has no 'shape' member (no-member)

I've try How do I get PyLint to recognize numpy members? and Disabling Pylint no member- E1101 error for specific libraries with no success.

like image 974
user3313834 Avatar asked Jan 20 '26 01:01

user3313834


1 Answers

This seems to be an open issue in pylint that has been marked high priority as of March 14th 2022.

The issue stems from the underlying AST engine that pylint uses that has a limit to the number of inferences it can make at runtime as a bid to improve performance.

For posteriority in case the link above ever dies, the workaround is as follows:

pylint some_file_to_lint.py --init-hook "import astroid; astroid.context.InferenceContext.max_inferred = 500"

Or in .pylintrc:

[MASTER]

init-hook = "import astroid; astroid.context.InferenceContext.max_inferred = 500"
like image 150
Rayan Hatout Avatar answered Jan 21 '26 13:01

Rayan Hatout



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!