下面是[mydataframe].info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1000 entries, 0 to 999
Data columns (total 1 columns):
receivedtime 1000 non-null datetime64[ns]
dtypes: datetime64[ns](1)
数据采用这种格式-
0 2018-08-18 14:24:59.783
1 2018-08-18 14:24:32.227
我不在乎日期。我只想将时间转换为秒(UTC)。以下是我想要的-
seconds
0 1534734768
1 1534734769
以下是我到目前为止尝试过的
strptime()
strptime() argument 1 must be str, not DataFrame
pd.to_datetime(df)
to assemble mappings requires at least that [year, month, day] be specified: [day,month,year] is missing
我之所以尝试这样做,是因为我试图像这样stat, p = normaltest(df)
来运行D’Agostino的K ^ 2测试,并且不断出现ufunc add cannot use operands with types dtype('<M8[ns]') and dtype('<M8[ns]')
错误。因此,我希望将其转换为秒后,将不再收到该错误。