Skip to content

Commit e444cdb

Browse files
jbrockmendelPingviinituutti
authored andcommitted
REF: DatetimeIndex constructor fixups (pandas-dev#23916)
1 parent 677f58a commit e444cdb

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

pandas/_libs/tslibs/conversion.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -866,8 +866,8 @@ def tz_localize_to_utc(ndarray[int64_t] vals, object tz, object ambiguous=None,
866866
- bool if True, treat all vals as DST. If False, treat them as non-DST
867867
- 'NaT' will return NaT where there are ambiguous times
868868
869-
nonexistent : str
870-
If arraylike, must have the same length as vals
869+
nonexistent : {None, "NaT", "shift", "raise"}
870+
How to handle non-existent times when converting wall times to UTC
871871
872872
.. versionadded:: 0.24.0
873873

pandas/core/arrays/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class DatetimeArrayMixin(dtl.DatetimeLikeArrayMixin):
183183
_freq = None
184184

185185
@classmethod
186-
def _simple_new(cls, values, freq=None, tz=None, **kwargs):
186+
def _simple_new(cls, values, freq=None, tz=None):
187187
"""
188188
we require the we have a dtype compat for the values
189189
if we are passed a non-dtype compat, then coerce using the constructor

pandas/core/indexes/datetimes.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -317,17 +317,15 @@ def __new__(cls, data=None,
317317
return subarr._deepcopy_if_needed(ref_to_data, copy)
318318

319319
@classmethod
320-
def _simple_new(cls, values, name=None, freq=None, tz=None,
321-
dtype=None, **kwargs):
320+
def _simple_new(cls, values, name=None, freq=None, tz=None, dtype=None):
322321
"""
323322
we require the we have a dtype compat for the values
324323
if we are passed a non-dtype compat, then coerce using the constructor
325324
"""
326325
# DatetimeArray._simple_new will accept either i8 or M8[ns] dtypes
327326
assert isinstance(values, np.ndarray), type(values)
328327

329-
result = super(DatetimeIndex, cls)._simple_new(values, freq, tz,
330-
**kwargs)
328+
result = super(DatetimeIndex, cls)._simple_new(values, freq, tz)
331329
result.name = name
332330
result._reset_identity()
333331
return result

pandas/tests/scalar/timedelta/test_timedelta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def test_overflow(self):
550550

551551
# mean
552552
result = (s - s.min()).mean()
553-
expected = pd.Timedelta((pd.DatetimeIndex((s - s.min())).asi8 / len(s)
553+
expected = pd.Timedelta((pd.TimedeltaIndex((s - s.min())).asi8 / len(s)
554554
).sum())
555555

556556
# the computation is converted to float so

0 commit comments

Comments
 (0)