#相同结果
aa = pd.date_range("2018-3-5 00:23:34","2038-3-5 00:23:34",freq="3d") #DatetimeIndex类型
bb = aa.month
aa = pd.Series(pd.date_range("2018-3-5 00:23:34","2038-3-5 00:23:34",freq="3d")) #Series,时间序列
bb = aa.dt.month
时间属性见网址:https://www.gairuo.com/p/pandas-time-attributes
网友评论