请请求帮助正确书写此内容。在这张照片上,我有一张有“团队”和“积分”的桌子。我想数一数每一个F1车队已经收集了多少分,以显示它的阴谋。我试着这样做:
team_points= cons.groupby('Team')['Points'].count()
team_points = pd.DataFrame(team_points)
team_points.columns = ['Points']
team_points.reset_index(level=0, inplace=True)
team_points.sort_values(by=['Points'], inplace=True,
ascending=False)
team_points = team_points.head(10)
team_points = team_points[::-1]
fig = px.bar(team_points, x='Team',
y='Points',color='Points',width=750, height=500)
fig.update_layout(title={'text': 'Teams with The Most Championships
Won','y':0.95,'x':0.5})
fig.show()
桌子
您的pandas代码正在做一些非常奇怪的事情
groupby().agg()
以获取总数相关问题 更多 >
编程相关推荐