python - Pandas: Using Unix epoch timestamp as Datetime index -


my application involves dealing data (contained in csv) of following form:

epoch (number of seconds since jan 1, 1970), value 1368431149,20.3 1368431150,21.4 .. 

currently read csv using numpy loadtxt method (can use read_csv pandas). series converting timestamps field follows:

timestamp_date=[datetime.datetime.fromtimestamp(timestamp_column[i]) in range(len(timestamp_column))] 

i follow setting timestamp_date datetime index dataframe. tried searching @ several places see if there quicker (inbuilt) way of using these unix epoch timestamps, not find any. lot of applications make use of such timestamp terminology.

  1. is there inbuilt method handling such timestamp formats?
  2. if not, recommended way of handling these formats?

convert them 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]) 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -