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

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

Asterisk AGI Python Script to Dialplan does not work -