浏览代码

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

ogert 4 年之前
父节点
当前提交
c14a86dc71
共有 1 个文件被更改,包括 3 次插入0 次删除
  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: