date range
pd.date_range(
'2014-11-19',
'2014-11-21', freq=
'D')
t = pd.DataFrame(pd.date_range(
'2014-11-19',
'2014-11-21', freq=
'D'))
使用 parse_dates 参数解析文件中的日期列时,则会将该列转化为 datetime64[ns] 类型(包含日期与时间)
1. datetime64[ns] 与 <M8[ns]
二者的区别在于,datetime64[ns] 是通用型数据类型,而 <M8[ns] 则属于特定型的数据类型(与物理机器有关,具体取决于大顶端和小顶端)
对于小顶端机器:
np.dtype(
'datetime64[ns]') == np.dtype(
'<M8[ns]')
对于大顶端机器:
np.dtype(
'datetime64[ns]') == np.dtype(
'>M8[ns]')
转载请注明原文地址: https://ju.6miu.com/read-668224.html