|
@@ -350,16 +350,16 @@ class MigrationCleaning:
|
|
|
formats=self._date_formats[column])
|
|
|
|
|
|
elif (python_type == int) and data[column].isnull().any():
|
|
|
-
|
|
|
+
|
|
|
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,
|
|
|
+ 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}
|
|
@@ -368,7 +368,7 @@ class MigrationCleaning:
|
|
|
|
|
|
|
|
|
elif python_type == str:
|
|
|
-
|
|
|
+
|
|
|
# might not be the smoothes solution but it works
|
|
|
python_type = str
|
|
|
data = data.copy(deep=True)
|
|
@@ -382,6 +382,10 @@ class MigrationCleaning:
|
|
|
data[column] = data[column].astype(python_type)
|
|
|
|
|
|
if data[column].dtype != python_type:
|
|
|
+ print('---------------------------------------------')
|
|
|
+ print(data[column].to_csv(column))
|
|
|
+ print(python_type)
|
|
|
+ print(column)
|
|
|
|
|
|
self.log.warning(("After conversion type in {0} "
|
|
|
"should be {1} "
|
|
@@ -578,4 +582,3 @@ if __name__ == "__main__":
|
|
|
data = cleaner.filter_notallowed_values(data)
|
|
|
|
|
|
print("Done!")
|
|
|
-
|