I have the foll. dictionary in python:
OrderedDict([(30, (\'A1\', 55.0)), (31, (\'A2\', 125.0)), (32, (\'A3\', 180.0)), (43, (\'A4\', nan))])
This should work:
for k,v in dict_cg.items(): if np.isnan(v[1]): dict_cg.pop(k) print dict_cg
Output:
OrderedDict([(30, ('A1', 55.0)), (31, ('A2', 125.0)), (32, ('A3', 180.0))])