查询datetime64 [ns]和时间戳

时间:2019-11-26 06:34:10

标签: python pandas

import matplotlib.pyplot as plt 
import pandas as pd
import pandas_datareader.data as web
import datetime as dt
import sys
import matplotlib.dates as mdates
import numpy as np

start=dt.datetime(2000,1,1)
end=dt.datetime(2018,12,31)

#importing financial data from yahoo
df=web.DataReader('SFR.AX', 'yahoo', start, end) 

#when importing you get Date as index. I dont want that so I put Date as a column and reset the indexes
df=df.reset_index(drop=False) 

#info tells me Date column is datetime64[ns] dtype
print df.info()

#but when I use type() on the 1st element of df['Date'] it tells me <class 'pandas._libs.tslibs.timestamps.Timestamp'>
print type(df['Date'][0])

我不明白,“日期”列到底是什么? datetime64 [ns]或时间戳?据我所知,它们是不同的。预先感谢

executing

0 个答案:

没有答案