I have a dataframe containing dictionaries in their cells. First I filter the columns where there are None values, in order to iterate and explore the ones with dictionaries. T iterate over the columns with dictionaries and my goal is to sum the values of those dictionaries and add them to a new column pero column explored.
I keep getting the error:
TypeError: 'NoneType' object is not iterable
The dataframe columns are something like this:
[In] `df['column_A'].iloc[1]`
[Out]
{'16875259': 0.0,
'16909775': 9.0,
'16909808': 214.0,
'16909816': 3696.0,
'16910032': 725.0,
'16910067': 27.0,
'16910182': 11.0,
'16910237': 4.0,
'16910262': 3191.0,
'16910358': 52.0,
'16910411': 73.0,
'16910416': 111.0,
'16910477': 1869.0,
'16910598': 2425
The code I managed to build is somthing like this:
for column in my_df:
if(my_df[column].values[1]!='None' or my_dfdf1[column].values[1] !=None):
for column in df1:
for item in df1[column].values:
for i in item:
#print(i)
# Here I need to sum the values
I expect the sum of the values but I keep getting the error:
TypeError: 'NoneType' object is not iterable