Hello this is using python panda
from collections import defaultdict
Unknown_dict = defaultdict(list)
for j, k in zip(my_unknown_id, my_unknown_intensity):
Unknown_dict[j].append(k)
print(Unknown_dict)
From the above code what I get is
defaultdict(<class 'list'>, {'ABC': [123, 345, 678], 'JIK': [456, 789], 'KIL': [100], 'JAL': [200], 'HON': [300]})
From this list I want to actually get the mean of the values inside the class list. For example for ABC I want to get (123+345+678)/3 and for JIK (456+789)/2.
I tried getting the mean of the values but I found out inside lists we cannot change values. I'm not sure if I got it wrong or does anyone know how to get the mean inside a list?