December 2018
Intermediate to advanced
318 pages
8h 28m
English
Our dataset is largely clean so we will directly transform the data into more meaningful forms. For example, the timestamp of the data is in epoch format. Epoch format is alternatively known as Unix or Posix time format. We will convert this to the date-time format that we have previously discussed, as shown in the following:
import timetime.strftime('%Y-%m-%d %H:%M:%S', time.localtime(1521388078))Out: '2018-03-18 21:17:58'
We perform the preceding operation on the Time column, add it to a new column, and call it Newtime:
pdata_frame['Newtime'] = pdata_frame['Time'].apply(lambda x: time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(float(x))))
Once we have transformed the data to a more readable format, we ...
Read now
Unlock full access