How do I ignore missing keys in a pd.DataFrame.from_dict
comprehension iteration?
@jezrael kindly answered my problem on making a df with dictionary values here:
https://stackoverflow.com/a/49072184/9242601
But I encountered a Key Error: 'fees'
error because not all "Customers" have a 'fees' key, so rather than generating an error, I'd like the iteration to just move on to the next Customer and not record that customer in the df.
I still need a dataframe, so try... except
and if key in dict
won't work, because I will just end up with an empty (or non-existent) df.
Apologies for effectively spreading this question over two questions, but I didn't think it was worth repeating the complete initial question (hence the link).
Thanks.