Skip to content

Commit 1dbf5d1

Browse files
committed
precommit
1 parent 469e28d commit 1dbf5d1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Diff for: pandas/core/algorithms.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
lib,
2525
)
2626
from pandas._libs.missing import NA
27+
from pandas._libs.tslibs.timestamps import Timestamp
2728
from pandas._typing import (
2829
AnyArrayLike,
2930
ArrayLike,
@@ -79,7 +80,6 @@
7980
na_value_for_dtype,
8081
)
8182

82-
from pandas._libs.tslibs.timestamps import Timestamp
8383
from pandas.core.array_algos.take import take_nd
8484
from pandas.core.construction import (
8585
array as pd_array,
@@ -1695,7 +1695,7 @@ def map_array(
16951695

16961696
if isinstance(arr.dtype, ArrowDtype) and arr.dtype.name.startswith("timestamp"):
16971697
try:
1698-
# Convert elements to pandas.Timestamp (or datetime64[ns]) for dict lookup
1698+
# Convert elements to pandas.Timestamp (or datetime64[ns])
16991699
arr = arr.astype("datetime64[ns]")
17001700
except Exception:
17011701
# fallback: safe, slow path

Diff for: pandas/tests/series/methods/test_map.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,11 @@ def test_map_kwargs():
605605
expected = Series([4, 6, 7])
606606
tm.assert_series_equal(result, expected)
607607

608+
608609
def test_map_arrow_timestamp_dict():
609610
# GH 61231
610-
ser = pd.Series(pd.date_range("2023-01-01", periods=3)).astype("timestamp[ns][pyarrow]")
611+
ser = Series(date_range("2023-01-01", periods=3)).astype("timestamp[ns][pyarrow]")
611612
mapper = {ts: i for i, ts in enumerate(ser)}
612613
result = ser.map(mapper)
613-
expected = pd.Series([0, 1, 2], dtype="int64")
614-
tm.assert_series_equal(result, expected)
614+
expected = Series([0, 1, 2], dtype="int64")
615+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)