Skip to content

Commit 44a8295

Browse files
committed
BUG: fix NumPy 1.7 cast-to-bool failure and buglet
1 parent 9d2d4bf commit 44a8295

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

doc/source/timeseries.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ We could have done the same thing with ``DateOffset``:
297297

298298
.. ipython:: python
299299
300-
from pandas.core.datetools import *
300+
from pandas.tseries.offsets import *
301301
d + DateOffset(months=4, days=5)
302302
303303
The key features of a ``DateOffset`` object are:

pandas/core/frame.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4226,9 +4226,9 @@ def _reduce(self, op, axis=0, skipna=True, numeric_only=None,
42264226
if result.dtype == np.object_:
42274227
try:
42284228
if filter_type is None or filter_type == 'numeric':
4229-
result = result.astype('f8')
4230-
elif filter_type == 'bool':
4231-
result = result.astype('b')
4229+
result = result.astype(np.float64)
4230+
elif filter_type == 'bool' and notnull(result).all():
4231+
result = result.astype(np.bool_)
42324232
else:
42334233
raise ValueError('Invalid dtype %s ' % str(filter_type))
42344234

pandas/core/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def asof(self, label):
405405
def asof_locs(self, where, mask):
406406
"""
407407
where : array of timestamps
408-
mask : array of booleans where data is NA
408+
mask : array of booleans where data is not NA
409409
410410
"""
411411
locs = self.values[mask].searchsorted(where.values, side='right')

0 commit comments

Comments
 (0)