-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dublicates from list of dicts #127
Comments
Hi @Zaab1t ! This is definitely one of the more common requests I get. It's mostly a matter of how you want to do duplicate detection. Most cases people have an "id" key of some sort, so they can do something like
But it gets more complex as the data structures become more nested and the equality test stricter. |
Well I get my data online and sometimes the same data appeared multiple times, which caused problems. Current solution:
|
Right, so your dicts' values are not nested and all hashable, which means you can just do:
And you should be good! :) |
I see. Taking care of nested mutable values wouldn't be fun. I'm gonna take a shot at it though. See how pretty a solution, we can come up with :) |
In Python 3, And in Python 2 too, where |
A method, function or perhaps even a frozendict could help achieve this in a clean way.
The text was updated successfully, but these errors were encountered: