Skip to content

BUG: Exception when calling pandas.isnull() with a pandas type object #27989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.25.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Indexing
Missing
^^^^^^^

-
- Fixed bug where object with no data attribute were not being caught (:issue:`27482`)
-
-

Expand Down
2 changes: 2 additions & 0 deletions pandas/core/dtypes/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions scripts/tests/test_27482.py
Original file line number Diff line number Diff line change
@@ -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()