Ex1:美国疫情数据集
现有美国4月12日至11月16日的疫情报表(在 /data/us_report
文件夹下),请将 New York
的 Confirmed, Deaths, Recovered, Active
合并为一张表,索引为按如下方法生成的日期字符串序列:
In [61]: date = pd.date_range('20200412', '20201116').to_series()
In [62]: date = date.dt.month.astype('string').str.zfill(2
....: ) +'-'+ date.dt.day.astype('string'
....: ).str.zfill(2) +'-'+ '2020'
....:
In [63]: date = date.tolist()
In [64]: date[:5]
Out[64]: ['04-12-2020', '04-13-2020', '04-14-2020', '04-15-2020', '04-16-2020']
Ex2:实现join函数
请实现带有 how
参数的 join
函数
- 假设连接的两表无公共列
- 调用方式为
join(df1, df2, how="left")
- 给出测试样例