该问题需要绘制一个图表,显示从13/3/2020到5/4/2020在马来西亚,印度尼西亚,新加坡,菲律宾和泰国的确诊病例数。为您的图形提供xlabel“ Day”,ylabel“ Cases”和标题“'东盟Covid-19确诊病例的演变”。另外,为您的图形提供适当的图例以显示五条曲线。
我的数据框“ cleaned1_Asean”:
1/22/20 1/23/20 1/24/20 ...... 4/4/20 4/5/20
Country/region
Malaysia 0 0 8 ...... 178 189
Indonesia 0 0 0 ....... 280 300
........
我过滤掉了东盟国家,但我不能过滤所需的日期,而且我也不知道如何绘制图表。有人可以帮忙吗?
用途:
print (df)
1/22/20 1/23/20 1/24/20 4/4/20 4/5/20
Country/region
Malaysia 0 0 8 178 189
Indonesia 0 0 0 280 300
Singapore 0 0 8 10 410
Philippines 0 0 0 20 85
print (df.columns)
Index(['1/22/20', '1/23/20', '1/24/20', '4/4/20', '4/5/20'], dtype='object')
print (df.index)
Index(['Malaysia', 'Indonesia', 'Singapore', 'Philippines'],
dtype='object', name='Country/region')
df.columns = pd.to_datetime(df.columns)
countries = ['Malaysia', 'Indonesia', 'Singapore', 'Philippines']
df = df.loc[countries, '2020-03-13':'2020-04-05']
print (df)
2020-04-04 2020-04-05
Country/region
Malaysia 178 189
Indonesia 280 300
Singapore 10 410
Philippines 20 85