格言样本:{'7/24/20':'redbank:280','7/23/20':'redbank:279','7/22/20':'redbank:277'} 我不能把它作为日期、城镇、计数输入熊猫
df = pd.DataFrame.from_dict(thelist, orient='index')
red_bank_covid_cnt = df[0].str.split(':', expand=True)
red_bank_covid_cnt.reindex(columns=['n']+red_bank_covid_cnt.columns[:-1].tolist())
red_bank_covid_cnt.info()
red_bank_covid_cnt.head()
output:
Index: 118 entries, 7/24/20 to 3/21/20
Data columns (total 2 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 0 118 non-null object
1 1 118 non-null object
dtypes: object(2)
memory usage: 2.8+ KB
0 1
7/24/20 Red Bank 280
7/23/20 Red Bank 279
7/22/20 Red Bank 277
7/21/20 Red Bank 275
7/17/20 Red Bank 269
I am trying to make a line graph.
另一种方法是将字典修改为字典列表
画线图
相关问题 更多 >
编程相关推荐