Hi everyone, I'm super new at this so I'm looking for some help. Please consider the following dataframe:
fruit sales price
0 lemon .. ..
1 orange .. ..
2 carrot .. ..
3 potato .. ..
4 pineapple .. ..
5 mango .. ..
Lets say that fruit column can be categorized in the following way: lemon + orange = citrus; carrot + potato = tuber; pineapple + mango = tropical.
After I would like to use this new grouping as an index for a pivot table. , in order to see average price or sales in a "citrus/tuber/tropical" segmentation.
In the dataframe I'm trying to apply this logic on there are too many values to make a ditionary.
Any help would be greatly appreciated :)
您可以为^{} 创建} witt aggregate ^{} :
dict
,并使用^{与^{} 类似的解决方案,但随后需要更改列名:
相关问题 更多 >
编程相关推荐