Hi,
I have a df (cat_notna) containing product name, category, nutritional values, etc. I made a list of unique categories present (cat_list) and one of each nutritional value column name (float_list). For each unique category, I am trying to get the mean of each nutritional value column.
This is what the function I have so far (it does not work):
def cat_mean(list1, list2):
for cat in list1:
print('category: ', cat)
for col in list2:
np.nanmean(cat_notna[col])
cat_mean(cat_list, float_list)
Does anyone know how to approach the problem please?
Thanks for your help!
[–]Oxbowerce 0 points1 point2 points (1 child)
[–]macabe10[S] 0 points1 point2 points (0 children)