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