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.
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"
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