How to find duplicate names using pandas?

前端 未结 6 1283
無奈伤痛
無奈伤痛 2020-12-14 02:27

I have a pandas.DataFrame with a column called name containing strings. I would like to get a list of the names which occur more than once in the c

6条回答
  •  醉酒成梦
    2020-12-14 02:49

    A one liner can be:

    x.set_index('name').index.get_duplicates()
    

    the index contains a method for finding duplicates, columns does not seem to have a similar method..

提交回复
热议问题