Skip to content

Commit 9421845

Browse files
committed
Write test
1 parent fe2db3d commit 9421845

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,11 @@ Datetimelike
496496
- Bug in :func:`date_range` where the last valid timestamp would sometimes not be produced (:issue:`56134`)
497497
- Bug in :func:`date_range` where using a negative frequency value would not include all points between the start and end values (:issue:`56382`)
498498
- Bug in :func:`tseries.api.guess_datetime_format` would fail to infer time format when "%Y" == "%H%M" (:issue:`57452`)
499-
- Bug in :math:`Series.dt.microsecond` producing incorrect results for pyarrow backed :class:`Series`. (:issue:`59154`)
500499
- Bug in :meth:`Dataframe.agg` with df with missing values resulting in IndexError (:issue:`58810`)
501500
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` does not raise on Custom business days frequencies bigger then "1C" (:issue:`58664`)
502501
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` returning ``False`` on double-digit frequencies (:issue:`58523`)
503502
- Bug in :meth:`DatetimeIndex.union` when ``unit`` was non-nanosecond (:issue:`59036`)
503+
- Bug in :meth:`Series.dt.microsecond` producing incorrect results for pyarrow backed :class:`Series`. (:issue:`59154`)
504504
- Bug in setting scalar values with mismatched resolution into arrays with non-nanosecond ``datetime64``, ``timedelta64`` or :class:`DatetimeTZDtype` incorrectly truncating those scalars (:issue:`56410`)
505505

506506
Timedelta

pandas/tests/extension/test_arrow.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,6 +2473,28 @@ def test_dt_properties(prop, expected):
24732473
tm.assert_series_equal(result, expected)
24742474

24752475

2476+
@pytest.mark.parametrize("microsecond", [2000, 5, 0])
2477+
def test_dt_microsecond(microsecond):
2478+
# GH 59183
2479+
ser = pd.Series(
2480+
[
2481+
pd.Timestamp(
2482+
year=2024,
2483+
month=7,
2484+
day=7,
2485+
second=5,
2486+
microsecond=microsecond,
2487+
nanosecond=6,
2488+
),
2489+
None,
2490+
],
2491+
dtype=ArrowDtype(pa.timestamp("ns")),
2492+
)
2493+
result = ser.dt.microsecond
2494+
expected = pd.Series([microsecond, None], dtype="int64[pyarrow]")
2495+
tm.assert_series_equal(result, expected)
2496+
2497+
24762498
def test_dt_is_month_start_end():
24772499
ser = pd.Series(
24782500
[

0 commit comments

Comments
 (0)