I am using pandas in python and I end up with the following table:
+---------------------+----------------------+-----------------+
| start | finish | duration |
+---------------------+----------------------+-----------------+
| 2013-08-12 12:00:00 | 2013-08-14 16:00:00 | 2 days 04:00:00 |
+---------------------+----------------------+-----------------+
dataframe=dataframe.to_json(orient='records',date_format='iso',double_precision=2,date_unit='s')
return jsonify(data=dataframe)
I send this over using an AJAX request as data
, and on the javascript side I end up with data.duration = 1970-01-03T04:00:00Z
How can I format the data frame so that when I call data.duration
I get 2 days 04:00:00
?
Note that duration is calculating using:
data_frame['duration'] = data_frame['finish'] - data_frame['start']