File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 76
76
na_value_for_dtype ,
77
77
)
78
78
79
+ import pandas as pd
79
80
from pandas import (
80
81
ArrowDtype ,
81
82
Categorical ,
@@ -2407,13 +2408,20 @@ def _factorize_keys(
2407
2408
or is_string_dtype (lk .dtype )
2408
2409
and not sort
2409
2410
)
2411
+ or is_string_dtype (lk .dtype )
2412
+ and lk .dtype .storage == "pyarrow"
2410
2413
):
2411
2414
lk , _ = lk ._values_for_factorize ()
2412
2415
2413
2416
# error: Item "ndarray" of "Union[Any, ndarray]" has no attribute
2414
2417
# "_values_for_factorize"
2415
2418
rk , _ = rk ._values_for_factorize () # type: ignore[union-attr]
2416
- elif isinstance (lk .dtype , ArrowDtype ) and is_string_dtype (lk .dtype ):
2419
+ elif (
2420
+ isinstance (lk .dtype , ArrowDtype )
2421
+ and is_string_dtype (lk .dtype )
2422
+ or isinstance (lk .dtype , pd .StringDtype )
2423
+ and lk .dtype .storage == "pyarrow"
2424
+ ):
2417
2425
import pyarrow as pa
2418
2426
import pyarrow .compute as pc
2419
2427
You can’t perform that action at this time.
0 commit comments