Skip to content

Commit 0fdaf68

Browse files
committed
comments
1 parent 29c3cf7 commit 0fdaf68

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

pandas/core/arrays/base.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ class ExtensionArray(object):
5959
* factorize / _values_for_factorize
6060
* argsort / _values_for_argsort
6161
62-
One can implement methods to handle array reductions.
63-
64-
* _reduce
65-
6662
The remaining methods implemented on this class should be performant,
6763
as they only compose abstract methods. Still, a more efficient
6864
implementation may be available, and these methods can be overridden.
6965
66+
One can implement methods to handle array reductions.
67+
68+
* _reduce
69+
7070
This class does not inherit from 'abc.ABCMeta' for performance reasons.
7171
Methods and properties required by the interface raise
7272
``pandas.errors.AbstractMethodError`` and no ``register`` method is
@@ -691,7 +691,7 @@ def _reduce(self, name, skipna=True, **kwargs):
691691
skipna : bool, default True
692692
if True, skip NaN values
693693
kwargs : dict
694-
ddof is the only supported kwarg
694+
Additional keyword arguments passed to the reduction function
695695
696696
Returns
697697
-------

pandas/core/arrays/integer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,9 @@ def _reduce(self, name, skipna=True, **kwargs):
546546
if name in ['any', 'all']:
547547
pass
548548

549-
# if we have a numeric op, provide coercion back to an integer
550-
# type if possible
551-
elif notna(result):
549+
# if we have a preservable numeric op,
550+
# provide coercion back to an integer type if possible
551+
elif name in ['sum', 'min', 'max'] and notna(result):
552552
int_result = int(result)
553553
if int_result == result:
554554
result = int_result

pandas/core/dtypes/common.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1237,8 +1237,7 @@ def is_datetime_or_timedelta_dtype(arr_or_dtype):
12371237
if arr_or_dtype is None:
12381238
return False
12391239
tipo = _get_dtype_type(arr_or_dtype)
1240-
return (issubclass(tipo, (np.datetime64, np.timedelta64)) or
1241-
is_datetime64tz_dtype(arr_or_dtype))
1240+
return issubclass(tipo, (np.datetime64, np.timedelta64))
12421241

12431242

12441243
def _is_unorderable_exception(e):

0 commit comments

Comments
 (0)