i have data look like this
data={"col1":[ [(1,22),(1.5,20),(3,32),(2,21)],
[(2,24),(2.5,22)],
[(6,12),(1.3,18),(5,21)],
[(4,25),(5,33),(7,21),(2,30)]],
"name":["A","B","C","F"]}
df=pd.DataFrame.from_dict(data)
print(df)
I will like to mean the first and the sec numbers in every row (list) two difrent colls so for the first cell i will get new coll that contain (1+1.5+3+2)\4 and one more col that have 22+20+32+21/4
i do somthing like that but its look messy with the loops
for i in df["col1"]:
mean_list = []
for first_numb in i:
mean_list.append(first_numb[0])
any idea?