Skip to content
Advertisement

List of dictionaries, remove dicts with some duplicate key, values

Removing duplicates from list of dicts is as simple as set(list) but i have got stuck with this specific task.

I need to filter a list of dicts only by some keys and keep only the first elements

JavaScript

I need to get this very result (keep only first elements with same ‘dep_code’ and ‘arr_code’)

JavaScript

Thanks for your time!

Advertisement

Answer

You need to save all found data in a list.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement