浏览代码

Add catch if statement in _make_flattened_list_of_distincts

ogert 5 年之前
父节点
当前提交
ac254e3c35
共有 1 个文件被更改,包括 5 次插入1 次删除
  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:
         '''
         '''