Browse Source

inserted print statements to mirgrationcelaning and change if conditio in dataframetocollection

tsteuer 5 years ago
parent
commit
3253098a62

+ 3 - 2
cdplib/db_migration/DataFrameToCollection.py

@@ -90,8 +90,9 @@ class DataFrameToCollection():
 
                 # check that there is only one possible value of this field
                 n_distinct_values = data.groupby(grp_fields, sort=False)[field].nunique().max()
-
-                if n_distinct_values != 1:
+                
+                #n_distinct_valus can be 0 if the column only contains NaN values
+                if n_distinct_values > 1:
                     err = "Field {0} is not unique with respect to {1}"\
                           .format(field, grp_fields)
 

+ 4 - 0
cdplib/db_migration/MigrationCleaning.py

@@ -366,6 +366,10 @@ class MigrationCleaning:
                     data[column] = data[column].astype(python_type)
 
                 if data[column].dtype != python_type:
+                    print('---------------------------------------------')
+                    print(data[column])
+                    print(python_type)
+                    print(column)
 
                     self.log.warning(("After conversion type in {0} "
                                        "should be {1} "