astroid icon indicating copy to clipboard operation
astroid copied to clipboard

Negating pandas.isna on a DataFrame gives pylint error E1130

Open yinchi opened this issue 3 years ago • 0 comments

Steps to reproduce

(pandas is 1.5.0)

'''
Called using "python -m app"
'''

import pandas

df = pandas.DataFrame(dict(a = [1,2], b = [3,4]))
_ = ~pandas.isna(df)

print(df)

Current behavior

> python -m pylint app.__main__

************* Module app.__main__
app\__main__.py:8:4: E1130: bad operand type for unary ~: NoneType (invalid-unary-operand-type)
app\__main__.py:8:4: E1130: bad operand type for unary ~: NoneType (invalid-unary-operand-type)
app\__main__.py:8:4: E1130: bad operand type for unary ~: NoneType (invalid-unary-operand-type)
app\__main__.py:8:4: E1130: bad operand type for unary ~: NoneType (invalid-unary-operand-type)
app\__main__.py:8:4: E1130: bad operand type for unary ~: NoneType (invalid-unary-operand-type)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

Expected behavior

The above errors should not appear, and definitely not multiple times for the same line!

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

2.12.10

Other comments

This only seems to affect the new pandas 1.5.0, whereas 1.4.4 does not raise any pylint errors.

yinchi avatar Oct 03 '22 22:10 yinchi