Browse Source

Add catch if statement in _make_flattened_list_of_distincts

ogert 4 years ago
parent
commit
ac254e3c35
1 changed files with 5 additions and 1 deletions
  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
          entries are arbitrary objects
          (pandas unique() method does not work if entries are of complex types)
          (pandas unique() method does not work if entries are of complex types)
         '''
         '''
+        
         uniques = self._make_list_of_distinct(x)
         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:
     def _unroll_nested_names(self, names: list) -> list:
         '''
         '''