我有一个看起来像这样的数据框(请参见下文):
Player Name Team PlayerMarketValue
Steph Curry Golden State Warriors 169027.4782
Steph Curry Golden State Warriors 169027.4782
Steph Curry Golden State Warriors 169027.4782
Steph Curry Golden State Warriors 169027.4782
Lebron James All Stars 120896.3772
Lebron James All Stars 120896.3772
Lebron James All Stars 120896.3772
Luka Doncic All Stars 36789.6562
Luka Doncic All Stars 36789.6562
Luka Doncic All Stars 36789.6562
我正在尝试找到一种对两者进行分组的好方法Team,然后PlayerName从这个中提取第一个实例,PlayerMarketValue然后对其求和,然后将此值写入其各自的Team.
在到达以下位置后,我遇到了障碍:
NBAData['TotalTeamVal'] = NBAData.groupby(['Team', 'Player Name'])['PlayerMarketValue'].first().sum()
即:我正在寻找(All Stars特别注意行):
慕桂英3389331
翻翻过去那场雪
POPMUISE
相关分类