File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 2424 lib ,
2525)
2626from pandas ._libs .missing import NA
27+ from pandas ._libs .tslibs .timestamps import Timestamp
2728from pandas ._typing import (
2829 AnyArrayLike ,
2930 ArrayLike ,
7980 na_value_for_dtype ,
8081)
8182
82- from pandas ._libs .tslibs .timestamps import Timestamp
8383from pandas .core .array_algos .take import take_nd
8484from 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
Original file line number Diff line number Diff 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+
608609def 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 )
You can’t perform that action at this time.
0 commit comments