0
我有以下代碼:大熊貓:時間戳轉換類型錯誤
import datatime as dt
print(type(row['my_timestamp']))
current_date = dt.date.fromtimestamp(row['my_timestamp'])
其中row
是熊貓數據幀的行。
但得到了下面的輸出和錯誤:
<class 'pandas.tslib.Timestamp'>
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-44-95348c1ae55f> in <module>()
10 print(type(row['my_timestamp']))
---> 11 current_date = dt.date.fromtimestamp(row['my_timestamp'])
TypeError: an integer is required (got type Timestamp)
任何想法,我可能會錯過?謝謝!