Pandas: Using Unix epoch timestamp as Datetime index

前端 未结 3 1219
误落风尘
误落风尘 2020-12-09 12:06

My application involves dealing with data (contained in a CSV) which is of the following form:

Epoch (number of seconds since Jan 1, 1970), Value
1368431149,         


        
3条回答
  •  不知归路
    2020-12-09 12:34

    Convert them to datetime64[s]:

    np.array([1368431149, 1368431150]).astype('datetime64[s]')
    # array([2013-05-13 07:45:49, 2013-05-13 07:45:50], dtype=datetime64[s])
    

提交回复
热议问题