Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Nov 29, 2023
1 parent fd41598 commit 4c5d138
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions pandas/tests/reshape/test_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,22 @@ def test_datetime_cut(unit, box):
# See https://github.com/pandas-dev/pandas/pull/56101#discussion_r1405325425
# for why we round to 8 seconds instead of 7
left = DatetimeIndex(
["2012-12-31 23:57:08", "2013-01-01 16:00:00", "2013-01-02 08:00:00"]
).as_unit(unit)
["2012-12-31 23:57:08", "2013-01-01 16:00:00", "2013-01-02 08:00:00"],
dtype=f"M8[{unit}]",
)
else:
left = DatetimeIndex(
["2012-12-31 23:57:07.200000", "2013-01-01 16:00:00", "2013-01-02 08:00:00"]
).as_unit(unit)
[
"2012-12-31 23:57:07.200000",
"2013-01-01 16:00:00",
"2013-01-02 08:00:00",
],
dtype=f"M8[{unit}]",
)
right = DatetimeIndex(
["2013-01-01 16:00:00", "2013-01-02 08:00:00", "2013-01-03 00:00:00"]
).as_unit(unit)
["2013-01-01 16:00:00", "2013-01-02 08:00:00", "2013-01-03 00:00:00"],
dtype=f"M8[{unit}]",
)

exp_intervals = IntervalIndex.from_arrays(left, right)
expected = Series(exp_intervals).astype(CategoricalDtype(ordered=True))
Expand Down

0 comments on commit 4c5d138

Please sign in to comment.