diff --git a/doc/source/whatsnew/v0.25.1.rst b/doc/source/whatsnew/v0.25.1.rst index 34b149a6b8261..58eb83b7d57ae 100644 --- a/doc/source/whatsnew/v0.25.1.rst +++ b/doc/source/whatsnew/v0.25.1.rst @@ -89,7 +89,7 @@ Indexing Missing ^^^^^^^ -- +- Fixed bug where object with no data attribute were not being caught (:issue:`27482`) - - diff --git a/pandas/core/dtypes/missing.py b/pandas/core/dtypes/missing.py index 6f599a6be6021..14ef46cf44cc6 100644 --- a/pandas/core/dtypes/missing.py +++ b/pandas/core/dtypes/missing.py @@ -128,6 +128,8 @@ def isna(obj): def _isna_new(obj): + if isinstance(obj,type): + return False if is_scalar(obj): return libmissing.checknull(obj) # hack (for now) because MI registers as ndarray diff --git a/scripts/tests/test_27482.py b/scripts/tests/test_27482.py new file mode 100644 index 0000000000000..e3b637728505b --- /dev/null +++ b/scripts/tests/test_27482.py @@ -0,0 +1,19 @@ +import pandas as pd +import pytest +import unittest + +class TestStringMethods(unittest.TestCase): + + def test1(self): + x = pd.Series([1,2,3,4]) + xt = type(x) + assert pd.isnull(xt)==False,"Passed" + + def test2(self): + y = pd.DataFrame({"col": [1,2,3,4]}) + yt = type(y) + assert pd.isnull(yt)==False,"Passed" + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file