【发布时间】:2020-06-04 17:23:04
【问题描述】:
我有以下数据框(实际上有数百行)
Location Date Court Winner
0 Paris 10/2/2018 Outdoor Flavio
1 Paris 10/2/2018 Indoor Luca
2 Paris 10/2/2018 Indoor Giovanni
3 Paris 10/2/2018 Indoor Luca
我想要做的是得到一个看起来像这样的嵌套字典:
{ 'Flavio' : { 'Outdoor' : 1 , 'Indoor' : 0 } , 'Luca' : {'Outdoor' : 0 , 'Indoor' : 2} }
等等。所以换句话说,我想确定获胜者在室外和室内球场上获胜的次数。
提前谢谢你!
【问题讨论】:
标签: python pandas dataframe dictionary