Skip to content

Commit

Permalink
Removing .values and formating code PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Souza committed Mar 24, 2017
1 parent 3f9c7fd commit 04b7306
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 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.values.all():
if nulls.all():
if is_series:
return pd.Series(np.nan, index=where)
else:
Expand Down
6 changes: 2 additions & 4 deletions pandas/tests/frame/test_asof.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@


class TestFrameAsof(TestData, tm.TestCase):

def setUp(self):
self.N = N = 50
self.rng = date_range('1/1/1990', periods=N, freq='53s')
self.df = DataFrame({'A': np.arange(N), 'B': np.arange(N)},
index=self.rng)

def test_basic(self):

df = self.df.copy()
df.loc[15:30, 'A'] = np.nan
dates = date_range('1/1/1990', periods=self.N * 3,
Expand All @@ -38,7 +36,6 @@ def test_basic(self):
self.assertTrue((rs == 14).all(1).all())

def test_subset(self):

N = 10
rng = date_range('1/1/1990', periods=N, freq='53s')
df = DataFrame({'A': np.arange(N), 'B': np.arange(N)},
Expand Down Expand Up @@ -96,7 +93,8 @@ def test_all_nans(self):

# testing multiple columns
dates = date_range('1/1/1990', periods=self.N * 3, freq='25s')
result = DataFrame(np.nan, index=self.rng, columns=['A', 'B', 'C']).asof(dates)
result = DataFrame(np.nan, index=self.rng,
columns=['A', 'B', 'C']).asof(dates)
expected = DataFrame(np.nan, index=dates, columns=['A', 'B', 'C'])
tm.assert_frame_equal(result, expected)

Expand Down

0 comments on commit 04b7306

Please sign in to comment.