0
我有對象類型的這樣的柱:如何將對象類型轉換爲python jupyter中的datetime64 [ns]?
quote['SellTime'].head()
Out[32]:
0 94520
1 94538
2 94609
3 94615
4 94617
Name: SellTime, dtype: object
我想將其轉換爲對日期時間(datetime64 [NS])格式。
我也做了下面的代碼:
quote['SellTime'].astype(str).astype(int)
t2 = quote['SellTime'].astype(str).str.zfill(6)
quote['SellTime'] = pd.to_datetime(t2, format='%H%M%S').dt.time
,但它仍然是對象類型:
quote['SellTime'].head()
0 09:45:20
1 09:45:38
2 09:46:09
3 09:46:15
4 09:46:17
Name: SellTime, dtype: object
我都試過,但我不不想在SellTime開始只是需要時間不是一年 – ary
我想我明白那年,但不可能在python中創建沒有日期的日期。但是可以創建[timedelta](http://pandas.pydata.org/pandas-docs/stable/timedeltas.html),whot是最接近你需要的。 – jezrael
That worked Tnx – ary