Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created December 23, 2020 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/6a32f037e5e101bcdc83efd187a71c44 to your computer and use it in GitHub Desktop.
Save amankharwal/6a32f037e5e101bcdc83efd187a71c44 to your computer and use it in GitHub Desktop.
matches_played=pd.concat([matches['team1'],matches['team2']])
matches_played=matches_played.value_counts().reset_index()
matches_played.columns=['Team','Total Matches']
matches_played['wins']=matches['winner'].value_counts().reset_index()['winner']
matches_played.set_index('Team',inplace=True)
totm = matches_played.reset_index().head(8)
trace = go.Table(
header=dict(values=["Team","Total Matches","Wins"],
fill = dict(color='#ff96ea'),
font = dict(color=['rgb(45, 45, 45)'] * 5, size=14),
align = ['center'],
height = 30),
cells=dict(values=[totm['Team'], totm['Total Matches'], totm['wins']],
fill = dict(color=['rgb(235, 193, 238)', 'rgba(228, 222, 249, 0.65)']),
align = ['center'], font_size=13, height=25))
layout = dict(
width=750,
height=420,
autosize=False,
title='Total Matches vs Wins per team',
margin = dict(t=100),
showlegend=False,
)
fig1 = dict(data=[trace], layout=layout)
iplot(fig1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment