diff --git a/pandapower/io_utils.py b/pandapower/io_utils.py index a24771a93..75434c4a3 100644 --- a/pandapower/io_utils.py +++ b/pandapower/io_utils.py @@ -575,14 +575,16 @@ def DataFrame(self): if column_names is not None: df.columns.names = column_names - # recreate jsoned objects - for col in ('object', 'controller'): # "controller" for backwards compatibility - if (col in df.columns): - df[col] = df[col].apply(partial( - self.pp_hook, ignore_unknown_objects=self.ignore_unknown_objects - )) if 'geo' in df.columns: df['geo'] = df['geo'].dropna().apply(json.dumps).apply(geojson.loads) + + df_obj = df.select_dtypes(include=['object']) + for col in df_obj: + df[col] = df[col].apply(partial( + self.pp_hook, ignore_unknown_objects=self.ignore_unknown_objects + )) + df[col] = df[col].astype(dtype = 'object') + df.loc[pd.isnull(df[col]), col] = None return df @from_serializable.register(class_name='pandapowerNet', module_name='pandapower.auxiliary')#,