Select to view content in your preferred language

Find duplicates, update only one record

2973
12
Jump to solution
08-13-2020 02:16 PM
2Quiker
Frequent Contributor

 I would like to only populate one of the  duplicate record but with number of duplicates like below.

How can do this or what is the best way to achieve this with python?

well_id      Dup

D36528   3

D36528

D36528

D36532   2

D36532

D36521

D36522

D36525   2

D36525
0 Kudos
12 Replies
forestknutsen1
MVP Regular Contributor

I like your's best Joshua, nice and clean

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

The Counter object was purpose built for situations like this.  Granted, it is fairly easy to implement with a dict or defaultdict, but there are some handy performance and syntax optimizations using the custom object.

0 Kudos
forestknutsen1
MVP Regular Contributor

I see that now -- I googled the Counter object right after reading your post. I am going to add it to my python toolbox.

0 Kudos