Explorar o código

Add catch if statement in _make_flattened_list_of_distincts

ogert %!s(int64=4) %!d(string=hai) anos
pai
achega
ac254e3c35
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      cdplib/db_migration/DataFrameToCollection.py

+ 5 - 1
cdplib/db_migration/DataFrameToCollection.py

@@ -310,8 +310,12 @@ class DataFrameToCollection():
          entries are arbitrary objects
          (pandas unique() method does not work if entries are of complex types)
         '''
+        
         uniques = self._make_list_of_distinct(x)
-        return uniques[0]
+        if len(uniques) > 0:
+            return uniques[0]
+        else:
+            return None
 
     def _unroll_nested_names(self, names: list) -> list:
         '''