I have the following df:
values_list = [[15, {'num':[0]}, 100], [20, {'num':[0]}, 50], [25, {'num':[0]}, 80],
[45, {'num':[0], 'option':[1]}, 48], [40, {'num':[0]}, 70], [41, {'num':[0]}, 90],
[51, {'num':[0]}, 111]]
df = pd.DataFrame(values_list, columns=['Field_1', 'Field_2', 'Field_3'])
Fields_2 is a column of dict.
I would like to perform the len following function and put it in a new column if I do :
len(df.Field_2[3])
output = 2 (and 1 for the other indexes)
What I would like as result is a DF as follows
I tried the following lambda function but it doesn't seem to work as I get a column with the len of the column not the row
df = df.assign(elem=lambda x: (len(x['Field_2'])))
i would have expected something more like this but this gives an error
df = df.assign(elem=lambda x: (x[len(x['Field_2'])]))
Could someone point me out how to solve this issue?
