Suppose I have the following DataFame:
df = pd.DataFrame(
{
'id':[112, 130, 200],
'name':['Lara', 'Kasia', 'Rocco'],
'level/income':[{1:400, 2:800}, {1:100}, {1:1000, 2:2000, 3:5000}]
}
)
I would like this to be the end result:
I tried to do this on my own but I failed spectacularly. I was trying to recreate the original DataFrame by finding which id and name would appear multiple times but this proved too much.
len_need = []
id2 = []
name2 = []
level2 = []
income2 = []
for index,row in df.iterrows():
len_need.append(len(row['level/income']))
I'm sure there's a better way to do this.

