| red | blue | winner| |:------|:-----:|------:| 0 |70.0 |67.0 |Red | 1 |74.0 |76.0 |Red | 2 |75.0 |75.0 |Red | 3 |63.0 |61.0 |Blue | 4 |68.0 |72.0 |Blue |
In a pandas DataFrame how would I add up the red and blue columns only when they are the winner which is shown on the winner column.
so in this example red = 70 + 74 + 75 and blue = 61 + 72
https://stackoverflow.com/questions/66848609/pandas-data-frame-how-to-add-up-c-column-based-on-another-column March 29, 2021 at 12:02PM
没有评论:
发表评论