소스 검색

Update if statement in Dataframe to Collection

tsteuer 4 년 전
부모
커밋
a8d68b0113
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      cdplib/db_migration/DataFrameToCollection.py

+ 2 - 1
cdplib/db_migration/DataFrameToCollection.py

@@ -94,7 +94,8 @@ 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)