我有一个有两列的数据框。 我只想要女性性别的结果
这是我的代码:
fpl_sales = sales[['Gender', 'Product line']]
fpl_sales
fpl_sales.groupby(['Gender', 'Product line'])['Product line'].count()
这是我的输出:
Gender Product line
Female Electronic accessories 84
Fashion accessories 96
Food and beverages 90
Health and beauty 64
Home and lifestyle 79
Sports and travel 88
Male Electronic accessories 86
Fashion accessories 82
Food and beverages 84
Health and beauty 88
Home and lifestyle 81
Sports and travel 78
Name: Product line, dtype: int64
这几乎是正确的,但是我只想要输出的女性部分
多谢各位
您可以像在第二行代码中那样进行筛选
带^{} 的熊猫分组:
或
或
相关问题 更多 >
编程相关推荐