Skip to content
Merged
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
10 changes: 10 additions & 0 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ def _isnull_ndarraylike(obj):
else:
result = np.isnan(values)

# box
if isinstance(obj, ABCSeries):
from pandas import Series
result = Series(result, index=obj.index, name=obj.name, copy=False)

return result


Expand All @@ -226,6 +231,11 @@ def _isnull_ndarraylike_old(obj):
else:
result = -np.isfinite(values)

# box
if isinstance(obj, ABCSeries):
from pandas import Series
result = Series(result, index=obj.index, name=obj.name, copy=False)

return result


Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_notnull():
with cf.option_context("mode.use_inf_as_null", False):
for s in [tm.makeFloatSeries(),tm.makeStringSeries(),
tm.makeObjectSeries(),tm.makeTimeSeries(),tm.makePeriodSeries()]:
assert(isinstance(isnull(s), np.ndarray))
assert(isinstance(isnull(s), Series))

def test_isnull():
assert not isnull(1.)
Expand All @@ -77,7 +77,7 @@ def test_isnull():

for s in [tm.makeFloatSeries(),tm.makeStringSeries(),
tm.makeObjectSeries(),tm.makeTimeSeries(),tm.makePeriodSeries()]:
assert(isinstance(isnull(s), np.ndarray))
assert(isinstance(isnull(s), Series))

# call on DataFrame
df = DataFrame(np.random.randn(10, 5))
Expand Down