Is it possible to manipulate each dictionary in iterable with lambdas?
To be clarify, just want to delete _id
key from each element.
Wonder If there is an elegant way to achieve this simple task without 3rd parties like (toolz), functions, or copying dict objects.
Possible solutions that I do not search for.
Traditional way:
cleansed = {k:v for k,v in data.items() if k not in ['_id'] }
Another way:
def clean(iterable): for d in iterable: del d['_id'] return
3rd Party way:
Python functional approach: remove key from dict using filter