在 Pandas 中加载 CSV 文件
capital_onebike.csv 文件包含 Capital Bikeshare 单车 W20529 在 10 月、11 月和 12 月的骑行记录。
以下是前两列:
| Start date | End date | ... |
|---|---|---|
| 2017-10-01 15:23:25 | 2017-10-01 15:26:26 | ... |
| 2017-10-01 15:42:57 | 2017-10-01 17:49:59 | ... |
本练习是课程的一部分
在 Python 中处理日期和时间
练习说明
- 导入 Pandas。
- 完成对
read_csv()的调用,使其正确解析日期列Start date和End date。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Import pandas
import ____ as pd
# Load CSV into the rides variable
rides = pd.read_csv('capital-onebike.csv',
parse_dates = ____)
# Print the initial (0th) row
print(rides.iloc[0])