Skip to content

Commit

Permalink
Propagating Series name
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Souza committed Mar 25, 2017
1 parent af9a29b commit bb63964
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3974,7 +3974,7 @@ def asof(self, where, subset=None):
nulls = self.isnull() if is_series else self[subset].isnull().any(1)
if nulls.all():
if is_series:
return pd.Series(np.nan, index=where)
return pd.Series(np.nan, index=where, name=self.name)
else:
if is_list:
return pd.DataFrame(np.nan, index=where,
Expand Down
4 changes: 4 additions & 0 deletions pandas/tests/series/test_asof.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,7 @@ def test_all_nans(self):
date = date_range('1/1/1990', periods=N * 3, freq='25s')[0]
result = Series(np.nan, index=rng).asof(date)
assert isnull(result)

# test name is propagated
result = Series(np.nan, index=[1, 2, 3, 4], name='test').asof([4, 5])
self.assertEqual(result.name, 'test')

0 comments on commit bb63964

Please sign in to comment.