Creating 30 Plotly charts based on multi-index Pandas series

Viewed 45

I've got a DataFrame with PLAYER_NAME, the corresponding cluster they're assigned to, their team's net rating, and their team ids. This is what it looks like:

This

I'd like to have a bunch of bar charts for each team that look like the following: this

The would be matched with the team's net rating and id. I've tried using groupby like this to get a multi-index Pandas series where there's a team_id and a cluster number corresponding to the number of instances that cluster appears for a certain team. It looks like this: this.

Unfortunately this removes the net rating, so I'm really not sure how to get all that info. I'm using plotly right now but if there's a solution with matplotlib that's fine.

This is the groupby code:

temp_df = pos_clusters.groupby(['TEAM_ID'])['Cluster'].value_counts().sort_index()

Thanks so much!

0 Answers
Related