Skip to content

Commit

Permalink
Minor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Souza committed Mar 23, 2017
1 parent 70c958f commit 3f9c7fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3972,7 +3972,7 @@ def asof(self, where, subset=None):
where = Index(where) if is_list else Index([where])

nulls = self.isnull() if is_series else self[subset].isnull().any(1)
if nulls.all():
if nulls.values.all():
if is_series:
return pd.Series(np.nan, index=where)
else:
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/frame/test_asof.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def test_missing(self):
tm.assert_frame_equal(result, expected)

def test_all_nans(self):
# series is all nans
# GH 15713
# DataFrame is all nans
result = DataFrame([np.nan]).asof([0])
expected = DataFrame([np.nan])
tm.assert_frame_equal(result, expected)
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/series/test_asof.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def test_errors(self):
s.asof(s.index[0], subset='foo')

def test_all_nans(self):
# GH 15713
# series is all nans
result = Series([np.nan]).asof([0])
expected = Series([np.nan])
Expand All @@ -167,4 +168,4 @@ def test_all_nans(self):
# testing scalar input
date = date_range('1/1/1990', periods=N * 3, freq='25s')[0]
result = Series(np.nan, index=rng).asof(date)
self.assertTrue(result != result)
assert isnull(result)

0 comments on commit 3f9c7fd

Please sign in to comment.