From 3e36d6b3b32f20e58da2b73f0f8c5137b1f98d70 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Sun, 25 Nov 2018 17:51:47 -0800 Subject: [PATCH 1/3] remove unused/invalid kwargs from simple_new signature --- pandas/core/arrays/datetimes.py | 2 +- pandas/core/indexes/datetimes.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index cdc4f7e61e7ca..ae366149ab899 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -183,7 +183,7 @@ class DatetimeArrayMixin(dtl.DatetimeLikeArrayMixin): _freq = None @classmethod - def _simple_new(cls, values, freq=None, tz=None, **kwargs): + def _simple_new(cls, values, freq=None, tz=None): """ we require the we have a dtype compat for the values if we are passed a non-dtype compat, then coerce using the constructor diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 6b66170e978ed..1ba14ffce383b 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -317,8 +317,7 @@ def __new__(cls, data=None, return subarr._deepcopy_if_needed(ref_to_data, copy) @classmethod - def _simple_new(cls, values, name=None, freq=None, tz=None, - dtype=None, **kwargs): + def _simple_new(cls, values, name=None, freq=None, tz=None, dtype=None): """ we require the we have a dtype compat for the values if we are passed a non-dtype compat, then coerce using the constructor @@ -326,8 +325,7 @@ def _simple_new(cls, values, name=None, freq=None, tz=None, # DatetimeArray._simple_new will accept either i8 or M8[ns] dtypes assert isinstance(values, np.ndarray), type(values) - result = super(DatetimeIndex, cls)._simple_new(values, freq, tz, - **kwargs) + result = super(DatetimeIndex, cls)._simple_new(values, freq, tz) result.name = name result._reset_identity() return result From 258bab8688c958056ac6edb2745613416bb598f9 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Sun, 25 Nov 2018 17:52:38 -0800 Subject: [PATCH 2/3] improve docstring for nonexistent --- pandas/_libs/tslibs/conversion.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/conversion.pyx b/pandas/_libs/tslibs/conversion.pyx index b4a13d3d0ada9..9d6daf3d42523 100644 --- a/pandas/_libs/tslibs/conversion.pyx +++ b/pandas/_libs/tslibs/conversion.pyx @@ -866,8 +866,8 @@ def tz_localize_to_utc(ndarray[int64_t] vals, object tz, object ambiguous=None, - bool if True, treat all vals as DST. If False, treat them as non-DST - 'NaT' will return NaT where there are ambiguous times - nonexistent : str - If arraylike, must have the same length as vals + nonexistent : {None, "NaT", "shift", "raise"} + How to handle non-existent times when converting wall times to UTC .. versionadded:: 0.24.0 From 2e7e5d9b209006a3c99ea688864644b8ddee9f7a Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Sun, 25 Nov 2018 17:55:56 -0800 Subject: [PATCH 3/3] fix incorrect test --- pandas/tests/scalar/timedelta/test_timedelta.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/scalar/timedelta/test_timedelta.py b/pandas/tests/scalar/timedelta/test_timedelta.py index f7dac81a5b8d7..82cfdb9e0751e 100644 --- a/pandas/tests/scalar/timedelta/test_timedelta.py +++ b/pandas/tests/scalar/timedelta/test_timedelta.py @@ -550,7 +550,7 @@ def test_overflow(self): # mean result = (s - s.min()).mean() - expected = pd.Timedelta((pd.DatetimeIndex((s - s.min())).asi8 / len(s) + expected = pd.Timedelta((pd.TimedeltaIndex((s - s.min())).asi8 / len(s) ).sum()) # the computation is converted to float so