Quellcode durchsuchen

Fix for converting float strings to float when the columns contains empty values.

ogert vor 4 Jahren
Ursprung
Commit
c14a86dc71
1 geänderte Dateien mit 3 neuen und 0 gelöschten Zeilen
  1. 3 0
      cdplib/db_migration/MigrationCleaning.py

+ 3 - 0
cdplib/db_migration/MigrationCleaning.py

@@ -397,6 +397,9 @@ class MigrationCleaning:
                 elif python_type == float:
                     
                     data[column] = data[column].fillna(np.inf)
+                    # Replaces empty fields when type is string
+                    if data[column].dtypes == object:
+                        data[column] = data[column].replace(r'^\s*$', str(np.inf), regex=True)
                     data[column] = data[column].astype(python_type)
 
                 else: