File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 5959)
6060from pandas .core .dtypes .concat import concat_compat
6161from pandas .core .dtypes .dtypes import (
62+ ArrowDtype ,
6263 BaseMaskedDtype ,
6364 CategoricalDtype ,
6465 ExtensionDtype ,
7879 na_value_for_dtype ,
7980)
8081
82+ from pandas ._libs .tslibs .timestamps import Timestamp
8183from pandas .core .array_algos .take import take_nd
8284from pandas .core .construction import (
8385 array as pd_array ,
@@ -1691,6 +1693,14 @@ def map_array(
16911693 if na_action == "ignore" :
16921694 mapper = mapper [mapper .index .notna ()]
16931695
1696+ if isinstance (arr .dtype , ArrowDtype ) and arr .dtype .name .startswith ("timestamp" ):
1697+ try :
1698+ # Convert elements to pandas.Timestamp (or datetime64[ns]) for dict lookup
1699+ arr = arr .astype ("datetime64[ns]" )
1700+ except Exception :
1701+ # fallback: safe, slow path
1702+ arr = np .array ([Timestamp (x .as_py ()) for x in arr ])
1703+
16941704 # Since values were input this means we came from either
16951705 # a dict or a series and mapper should be an index
16961706 indexer = mapper .index .get_indexer (arr )
You can’t perform that action at this time.
0 commit comments