File tree 1 file changed +7
-2
lines changed
modin/core/dataframe/pandas/dataframe
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -4698,8 +4698,6 @@ def to_pandas(self):
4698
4698
df = self ._partition_mgr_cls .to_pandas (self ._partitions )
4699
4699
if df .empty :
4700
4700
df = pandas .DataFrame (columns = self .columns , index = self .index )
4701
- if len (df .columns ) and self .has_materialized_dtypes :
4702
- df = df .astype (self .dtypes )
4703
4701
else :
4704
4702
for axis , has_external_index in enumerate (
4705
4703
["has_materialized_index" , "has_materialized_columns" ]
@@ -4717,6 +4715,13 @@ def to_pandas(self):
4717
4715
# into the internal ones
4718
4716
df = df .set_axis (axis = axis , labels = external_index , copy = False )
4719
4717
4718
+ # Hacky way to coerce the output to the correct type for booleans which might
4719
+ # contain NA
4720
+ if len (df .columns ) and self .has_materialized_dtypes :
4721
+ #df = df.astype(self.dtypes)
4722
+ for col in self .dtypes .index :
4723
+ if df .dtypes [col ] != self .dtypes [col ] and self .dtypes [col ] == np .dtype ('bool' ):
4724
+ df [col ] = df [col ].replace (1.0 , True ).replace (0.0 , False )
4720
4725
return df
4721
4726
4722
4727
def to_numpy (self , ** kwargs ):
You can’t perform that action at this time.
0 commit comments