Skip to content

Commit 031e5f7

Browse files
committed
make Series.hasnans return python bool
1 parent 25225ae commit 031e5f7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/source/whatsnew/v0.24.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ Other API Changes
910910
has an improved ``KeyError`` message, and will not fail on duplicate column names with ``drop=True``. (:issue:`22484`)
911911
- Slicing a single row of a DataFrame with multiple ExtensionArrays of the same type now preserves the dtype, rather than coercing to object (:issue:`22784`)
912912
- :class:`DateOffset` attribute `_cacheable` and method `_should_cache` have been removed (:issue:`23118`)
913-
- :meth:`Index.hasnans` now always returns a python boolean. Previously, it could return a python or a numpy boolean, depending on circumstances (:issue:`23294`).
913+
- :meth:`Index.hasnans` and :meth:`Series.hasnans` now always return a python boolean. Previously, a python or a numpy boolean could be returned, depending on circumstances (:issue:`23294`).
914914

915915
.. _whatsnew_0240.deprecations:
916916

pandas/core/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ def __iter__(self):
889889
@cache_readonly
890890
def hasnans(self):
891891
""" return if I have any nans; enables various perf speedups """
892-
return isna(self).any()
892+
return bool(isna(self).any())
893893

894894
def _reduce(self, op, name, axis=0, skipna=True, numeric_only=None,
895895
filter_type=None, **kwds):

0 commit comments

Comments
 (0)