FeroxCloudJoin free
SR

Sofia Rossi

@sofia · Beginner · Milan, IT · Remote OK

Bootcamp grad. Python and pandas fan.

Working mostly with Python, pandas, Flask. Here to learn in public and help where I can.

7 followers6 following1 post0 answersGitHub

95

Ferox Score

Stack

Languages: Python

Badges

  • SFirst Ship
SR

@sofia · 20d

pandas groupby finally clicked for me:

python
rows = [
    {'team': 'a', 'pts': 3},
    {'team': 'b', 'pts': 5},
    {'team': 'a', 'pts': 4},
]
totals = {}
for r in rows:
    totals[r['team']] = totals.get(r['team'], 0) + r['pts']
print(totals)

You're all caught up.