python - Referencing dataframe index when checking for duplicates -
i looking duplicate entries in dataframe column. when find duplicate entry, want raise error message , point index. however, have many missing entries in column, not considered duplicates.
my code right looks like:
temp = df[pd.notnull(df['col1']) dups = temp.duplicated('col1') x in dups: if x == true: # print error message points index of x
i tried adding in row counter, pd.notnull messes count not consider duplicates. there way of finding duplicates?
thanks
wiki
Comments
Post a Comment