For more information on what you can do with grouping and aggregating, check out Pandas GroupBy: Your Guide to Grouping Data in Python.
Grouping and Aggregating Your Data
Was their record better in the playoffs? By adding the
'is_playoffs' column to the
.groupby(), the games will be first grouped into playoff and regular season and then by wins and losses. Notice that when grouping a single column, use just the string name, but when grouping more than one column, use a list of names. There’s much more you can do with grouping and aggregating. Check out this post on Real Python for more.
Become a Member to join the conversation.