From f1cbf4f313e183ef9ac294784cea74162489cf2c Mon Sep 17 00:00:00 2001 From: joy-rosie Date: Tue, 30 Jul 2019 21:21:20 +0100 Subject: [PATCH 1/5] added a check for if obj is instance of type in _isna-new --- pandas/core/dtypes/missing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/core/dtypes/missing.py b/pandas/core/dtypes/missing.py index 6f599a6be6021..7d36ec435c0e1 100644 --- a/pandas/core/dtypes/missing.py +++ b/pandas/core/dtypes/missing.py @@ -133,6 +133,8 @@ def _isna_new(obj): # hack (for now) because MI registers as ndarray elif isinstance(obj, ABCMultiIndex): raise NotImplementedError("isna is not defined for MultiIndex") + elif isinstance(obj, type): + return False elif isinstance( obj, ( From 7aef72cede956a1ddecb2c0767f2d9f52c197eae Mon Sep 17 00:00:00 2001 From: joy-rosie Date: Wed, 31 Jul 2019 20:55:30 +0100 Subject: [PATCH 2/5] add tests and add to _isna_old --- pandas/core/dtypes/missing.py | 2 ++ pandas/tests/dtypes/test_missing.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/pandas/core/dtypes/missing.py b/pandas/core/dtypes/missing.py index 7d36ec435c0e1..056cd2222af3c 100644 --- a/pandas/core/dtypes/missing.py +++ b/pandas/core/dtypes/missing.py @@ -173,6 +173,8 @@ def _isna_old(obj): # hack (for now) because MI registers as ndarray elif isinstance(obj, ABCMultiIndex): raise NotImplementedError("isna is not defined for MultiIndex") + elif isinstance(obj, type): + return False elif isinstance(obj, (ABCSeries, np.ndarray, ABCIndexClass)): return _isna_ndarraylike_old(obj) elif isinstance(obj, ABCGeneric): diff --git a/pandas/tests/dtypes/test_missing.py b/pandas/tests/dtypes/test_missing.py index a688dec50bc95..bbc485ecf94f2 100644 --- a/pandas/tests/dtypes/test_missing.py +++ b/pandas/tests/dtypes/test_missing.py @@ -86,6 +86,10 @@ def test_isna_isnull(self, isna_f): assert not isna_f(np.inf) assert not isna_f(-np.inf) + # type + assert not isna_f(type(pd.Series())) + assert not isna_f(type(pd.DataFrame())) + # series for s in [ tm.makeFloatSeries(), From 8ad5c1270de36cea0ff39fbc7311c69b92cb3217 Mon Sep 17 00:00:00 2001 From: joy-rosie Date: Wed, 14 Aug 2019 20:17:23 +0100 Subject: [PATCH 3/5] add in whatsnew --- doc/source/whatsnew/v0.25.1.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.25.1.rst b/doc/source/whatsnew/v0.25.1.rst index fb67decb46b64..50979a1d94f2d 100644 --- a/doc/source/whatsnew/v0.25.1.rst +++ b/doc/source/whatsnew/v0.25.1.rst @@ -93,7 +93,9 @@ Indexing Missing ^^^^^^^ -- +- Bug in :func:`pandas.isnull` or :func:`pandas.isna` when the input is a type e.g. `type(pandas.Series()) (:issue:27482) + + - - From 97850043425305fd27920f94e6800e2981a89356 Mon Sep 17 00:00:00 2001 From: joy-rosie Date: Wed, 14 Aug 2019 20:18:36 +0100 Subject: [PATCH 4/5] fix typo in whatsnew --- doc/source/whatsnew/v0.25.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.25.1.rst b/doc/source/whatsnew/v0.25.1.rst index 50979a1d94f2d..aaedbcacef94f 100644 --- a/doc/source/whatsnew/v0.25.1.rst +++ b/doc/source/whatsnew/v0.25.1.rst @@ -93,7 +93,7 @@ Indexing Missing ^^^^^^^ -- Bug in :func:`pandas.isnull` or :func:`pandas.isna` when the input is a type e.g. `type(pandas.Series()) (:issue:27482) +- Bug in :func:`pandas.isnull` or :func:`pandas.isna` when the input is a type e.g. `type(pandas.Series())` (:issue:27482) - From 84170c080da76369ddf907e543ea25136a0ea1cd Mon Sep 17 00:00:00 2001 From: joy-rosie Date: Wed, 14 Aug 2019 20:19:36 +0100 Subject: [PATCH 5/5] fix typo in whatsnew --- doc/source/whatsnew/v0.25.1.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/source/whatsnew/v0.25.1.rst b/doc/source/whatsnew/v0.25.1.rst index aaedbcacef94f..fb791eaafe25f 100644 --- a/doc/source/whatsnew/v0.25.1.rst +++ b/doc/source/whatsnew/v0.25.1.rst @@ -93,9 +93,7 @@ Indexing Missing ^^^^^^^ -- Bug in :func:`pandas.isnull` or :func:`pandas.isna` when the input is a type e.g. `type(pandas.Series())` (:issue:27482) - - +- Bug in :func:`pandas.isnull` or :func:`pandas.isna` when the input is a type e.g. `type(pandas.Series())` (:issue:`27482`) - -