Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,7 @@ Datetimelike
- Bug in :attr:`Series.dt` where the cache would not update properly after an in-place operation (:issue:`24408`)
- Bug in :class:`PeriodIndex` where comparisons against an array-like object with length 1 failed to raise ``ValueError`` (:issue:`23078`)
- Bug in :meth:`DatetimeIndex.astype`, :meth:`PeriodIndex.astype` and :meth:`TimedeltaIndex.astype` ignoring the sign of the ``dtype`` for unsigned integer dtypes (:issue:`24405`).
- Fixed bug in :meth:`Series.max` with ``datetime64[ns]``-dtype failing to return ``NaT`` when nulls are present and ``skipna=False`` is passed (:issue:`24265`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is only for tz aware right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the example in 24265 was tz-naive


Timedelta
^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def repeat(self, repeats, *args, **kwargs):
"""
nv.validate_repeat(args, kwargs)
values = self._data.repeat(repeats)
return type(self)(values, dtype=self.dtype)
return type(self)._simple_new(values, dtype=self.dtype)

# ------------------------------------------------------------------
# Null Handling
Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/arrays/test_datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,10 @@ def test_setitem_clears_freq(self):
tz='US/Central'))
a[0] = pd.Timestamp("2000", tz="US/Central")
assert a.freq is None

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this near other repeat tests

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no other repeat tests AFAICT; I think those are in the tests.extension part of 24024

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(pandas) bash-3.2$ grep -r test_repeat pandas/tests
pandas/tests/series/test_analytics.py:    def test_repeat(self):
pandas/tests/extension/base/methods.py:    def test_repeat(self, data, repeats, as_series, use_numpy):
pandas/tests/extension/base/methods.py:    def test_repeat_raises(self, data, repeats, kwargs, error, msg, use_numpy):
Binary file pandas/tests/extension/base/__pycache__/methods.cpython-36.pyc matches
pandas/tests/io/test_stata.py:    def test_repeated_column_labels(self):
pandas/tests/test_multilevel.py:    def test_repeat(self):
pandas/tests/test_strings.py:    def test_repeat(self):
pandas/tests/indexes/multi/test_reshape.py:def test_repeat():
pandas/tests/indexes/period/test_period.py:    def test_repeat_freqstr(self, index, use_numpy):
pandas/tests/indexes/common.py:    def test_repeat(self):
pandas/tests/indexes/datetimes/test_ops.py:    def test_repeat_range(self, tz_naive_fixture):
pandas/tests/indexes/datetimes/test_ops.py:    def test_repeat(self, tz_naive_fixture):
pandas/tests/indexes/timedeltas/test_ops.py:    def test_repeat(self):
pandas/tests/indexes/test_base.py:    def test_repeat(self):

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, i meant repeat tests for DTA/TDA/PA. There are more coming up in the tests.extension part of 24024.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i guess that 's fine. need a followup then to consolidate DTI/DTA test for common methods at some point then.

def test_repeat_preserves_tz(self):
dti = pd.date_range('2000', periods=2, freq='D', tz='US/Central')
arr = DatetimeArray(dti)

repeated = arr.repeat([1, 1])
tm.assert_equal(arr, repeated)