File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 24
24
lib ,
25
25
)
26
26
from pandas ._libs .missing import NA
27
+ from pandas ._libs .tslibs .timestamps import Timestamp
27
28
from pandas ._typing import (
28
29
AnyArrayLike ,
29
30
ArrayLike ,
79
80
na_value_for_dtype ,
80
81
)
81
82
82
- from pandas ._libs .tslibs .timestamps import Timestamp
83
83
from pandas .core .array_algos .take import take_nd
84
84
from pandas .core .construction import (
85
85
array as pd_array ,
@@ -1695,7 +1695,7 @@ def map_array(
1695
1695
1696
1696
if isinstance (arr .dtype , ArrowDtype ) and arr .dtype .name .startswith ("timestamp" ):
1697
1697
try :
1698
- # Convert elements to pandas.Timestamp (or datetime64[ns]) for dict lookup
1698
+ # Convert elements to pandas.Timestamp (or datetime64[ns])
1699
1699
arr = arr .astype ("datetime64[ns]" )
1700
1700
except Exception :
1701
1701
# fallback: safe, slow path
Original file line number Diff line number Diff line change @@ -605,10 +605,11 @@ def test_map_kwargs():
605
605
expected = Series ([4 , 6 , 7 ])
606
606
tm .assert_series_equal (result , expected )
607
607
608
+
608
609
def test_map_arrow_timestamp_dict ():
609
610
# 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]" )
611
612
mapper = {ts : i for i , ts in enumerate (ser )}
612
613
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 )
You can’t perform that action at this time.
0 commit comments