pandas 查看某列的值有重复值,并将这些重复值找出来

我们先知道某一列是否有重复值,并将这些重复值找出来

a = zongti.groupby('reportno').count()>1
a[a['ref_id'] == True].index  #里面的列,随便一列都行

结果:

Index(['2016122100003477314271', '2017011100003543220588',
'2017012000003575254500', '2017012400003588159436',
'2017020700003607883826', '2018041300005391719350',
'2018041600005402623170', '2018042000005423149388',
'2019010900006795508613'],
dtype='object', name='reportno')

即可

posted on 2021-01-12 17:39  小小喽啰  阅读(6895)  评论(0编辑  收藏  举报