我是Pandas和Matplotlib的新手,想绘制此DataFrame
season won team matches pct_won
0 2008/2009 28.0 Manchester United 38 73.684211
1 2009/2010 27.0 Manchester United 38 71.052632
2 2010/2011 23.0 Manchester United 38 60.526316
3 2011/2012 28.0 Manchester United 38 73.684211
4 2012/2013 28.0 Manchester United 38 73.684211
5 2013/2014 19.0 Manchester United 38 50.000000
6 2014/2015 20.0 Manchester United 38 52.631579
7 2015/2016 19.0 Manchester United 38 50.000000
Run Code Online (Sandbox Code Playgroud)
使用以下代码行:
ax = aggregated_frame.plot(x='season', y='pct_won', figsize=(8,8), marker='o', rot=90, title='Performance by season of Team: {}'.format(aggregated_frame.iloc[0]['team']))
ax.set_xticklabels(aggregated_frame.season)
ax.set_xlabel('')
ax.yaxis.grid()
ax.yaxis.set_major_formatter(mtick.PercentFormatter()) …
Run Code Online (Sandbox Code Playgroud)