我有一个DF,如下:
top5graph.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 405 entries, 0 to 404
Data columns (total 12 columns):
CountryName 405 non-null object
CountryCode 405 non-null object
**Date 405 non-null int64**
School closing 405 non-null int64
Stay at home requirements 405 non-null int64
ConfirmedCases 405 non-null float64
ConfirmedDeaths 405 non-null float64
StringencyIndex 405 non-null float64
Continent_Name 405 non-null object
SCIndex 405 non-null object
WFHIndex 405 non-null object
NewDate 405 non-null object
dtypes: float64(3), int64(3), object(6)
memory usage: 38.0+ KB
Original Dataset looks like this:
20200301
运行命令以将“日期”列转换为日期格式:
top5graph['Date'] = pd.to_datetime(top5graph['Date'])
1970-01-01 00:00:00.020200301
这是我尝试过的:
parse_dates=[0]
中的pd.read()
重新加载数据集%Y%m%d
格式转换格式也没有用有人可以帮我弄清楚为什么会这样吗?