Browse Source

update MigrationCleaning to handel bool Ja/Nein

tsteuer 4 years ago
parent
commit
957f713539
1 changed files with 12 additions and 0 deletions
  1. 12 0
      cdplib/db_migration/MigrationCleaning.py

+ 12 - 0
cdplib/db_migration/MigrationCleaning.py

@@ -352,6 +352,18 @@ class MigrationCleaning:
                     self.log.log_and_raise_error(("Column {} contains missing values "
                                         "and cannot be of integer type"
                                         .format(column)))
+                    
+                elif python_type == bool:
+                    
+                    data[column] = data[column].str.lower()
+                    accepted_bool = {'ja': True, 'j': True, '1': True, 
+                                     'yes': True, 'y': True, 'true':True, 
+                                     't': True, 'nein': False, 'n': False,
+                                     'no': False, 'false': False, 'f': False,
+                                     '0': False}
+                    data[column] = data[column].map(accepted_bool)
+                    data[column] = data[column].astype(bool)
+
 
                 elif python_type == str: