我有一个如下所示的数据框:-
df1.set_index('date', inplace=True)
date symbol roe
2019-12-31 FMC 21.2189
2018-12-31 FMC 16.7456
2017-12-31 FMC -4.9167
2016-12-31 FMC 6.5580
2015-12-31 FMC -11.1408
2014-12-31 FMC 19.6675
2013-12-31 FMC 23.6372
2012-12-31 FMC 29.7916
2011-12-31 FMC 32.2291
2010-12-31 FMC 18.3737
2009-12-31 FMC 22.6811
2008-12-31 FMC 35.8547
2007-12-31 FMC 15.6253
2006-12-31 FMC 14.2645
2005-12-31 FMC 11.2999
2019-12-31 VMC 21.2189
2018-12-31 VMC 16.7456
2017-12-31 VMC -4.9167
2016-12-31 VMC 6.5580
2015-12-31 VMC -11.1408
2014-12-31 VMC 19.6675
2013-12-31 VMC 23.6372
2012-12-31 VMC 29.7916
2011-12-31 VMC 32.2291
2010-12-31 VMC 18.3737
2009-12-31 VMC 22.6811
2008-12-31 VMC 35.8547
2007-12-31 VMC 15.6253
2006-12-31 VMC 14.2645
2005-12-31 VMC 11.2999
2019-12-31 APD 21.2189
2018-12-31 APD 16.7456
2017-12-31 APD -4.9167
2016-12-31 APD 6.5580
2015-12-31 APD -11.1408
2014-12-31 APD 19.6675
2013-12-31 APD 23.6372
2012-12-31 APD 29.7916
2011-12-31 APD 32.2291
2010-12-31 APD 18.3737
2009-12-31 APD 22.6811
2008-12-31 APD 35.8547
2007-12-31 APD 15.6253
2006-12-31 APD 14.2645
2005-12-31 APD 11.2999
2019-12-31 MLM 21.2189
2018-12-31 MLM 16.7456
2017-12-31 MLM -4.9167
2016-12-31 MLM 6.5580
2015-12-31 MLM -11.1408
2014-12-31 MLM 19.6675
2013-12-31 MLM 23.6372
2012-12-31 MLM 29.7916
2011-12-31 MLM 32.2291
2010-12-31 MLM 18.3737
2009-12-31 MLM 22.6811
2008-12-31 MLM 35.8547
2007-12-31 MLM 15.6253
2006-12-31 MLM 14.2645
2005-12-31 MLM 11.2999
2019-12-31 NEM 21.2189
2018-12-31 NEM 16.7456
2017-12-31 NEM -4.9167
2016-12-31 NEM 6.5580
2015-12-31 NEM -11.1408
2014-12-31 NEM 19.6675
2013-12-31 NEM 23.6372
2012-12-31 NEM 29.7916
2011-12-31 NEM 32.2291
2010-12-31 NEM 18.3737
2009-12-31 NEM 22.6811
2008-12-31 NEM 35.8547
2007-12-31 NEM 15.6253
2006-12-31 NEM 14.2645
2005-12-31 NEM 11.2999
我已经将日期设置为索引,并使用 groupby 函数来绘制图表,代码如下所示:-
df1.groupby('symbol')['roe'].plot(figsize = (8, 6), legend=True)
输出仅显示 1 行。除了输出将显示 5 个不同的图形之外,因为数据框中有 5 个不同的符号,我可以知道如何解决这个问题吗?
开满天机
相关分类