File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2440,6 +2440,9 @@ def get_dummies(
2440
2440
input_series = (
2441
2441
Series (self ._data ) if isinstance (self ._data , ABCIndex ) else self ._data
2442
2442
)
2443
+ if isinstance (self ._data .dtype , ArrowDtype ):
2444
+ import pyarrow as pa
2445
+ dtype = ArrowDtype (pa .bool_ ())
2443
2446
string_series = input_series .apply (lambda x : str (x ) if not isna (x ) else x )
2444
2447
split_series = string_series .str .split (sep , expand = True ).stack ()
2445
2448
valid_split_series = split_series [
@@ -2486,9 +2489,13 @@ def get_dummies(
2486
2489
f"{ prefix [i ]} { prefix_sep } { col } "
2487
2490
for i , col in enumerate (result_df .columns )
2488
2491
]
2489
-
2492
+
2490
2493
if isinstance (self ._data , ABCIndex ):
2491
2494
return MultiIndex .from_frame (result_df )
2495
+
2496
+ result_df .attrs = self ._data .attrs
2497
+ if dtype is not None and not sparse :
2498
+ return result_df .astype (dtype )
2492
2499
return result_df
2493
2500
2494
2501
@forbid_nonstring_types (["bytes" ])
You can’t perform that action at this time.
0 commit comments