2019-04-29
阅读量:
388
python将数据和时间分成单独的功能
python如何将数据和时间分成单独的功能?
# Create date and time with dataframerng = pd.DataFrame()rng['date'] = pd.date_range('1/1/2011', periods = 72, freq ='H')
# Print the dates in dd-mm-yy formatrng[:5]
# Create features for year, month, day, hour, and minuterng['year'] = rng['date'].dt.yearrng['month'] = rng['date'].dt.monthrng['day'] = rng['date'].dt.dayrng['hour'] = rng['date'].dt.hourrng['minute'] = rng['date'].dt.minute
# Print the dates divided into featuresrng.head(3)
输出:

120.0000
1
2
关注作者
收藏
评论(0)
发表评论
暂无数据
推荐帖子
0条评论
0条评论
0条评论

