completed deadline
15-07-2013 23:10 15-07-2013 23:15
16-07-2013 00:20 16-07-2013 00:15
16-07-2013 00:20 16-07-2013 00:15
16-07-2013 21:04 16-07-2013 21:30
16-07-2013 21:58 16-07-2013 22:00
16-07-2013 23:21 16-07-2013 23:15
16-07-2013 23:21 16-07-2013 23:15
17-07-2013 00:19 17-07-2013 00:15
17-07-2013 00:19 17-07-2013 00:15
17-07-2013 21:18 17-07-2013 21:30
17-07-2013 22:07 17-07-2013 22:00
當我說data['completed'] - data['deadline']
我得到;使用python熊貓計算時差和打印到csv
-1 day, 23:55:00 # on time
0:05:00
0:05:00
-1 day, 23:34:00 # on time
-1 day, 23:58:00 # on time
0:06:00
0:06:00
0:04:00
0:04:00
-1 day, 23:48:00 # on time
0:07:00
但是當我做data['time_delay'] = data['completed'] - data['deadline']
和打印data['time_delay']
我得到的;
-300000000000
300000000000
300000000000
-1560000000000
-120000000000
360000000000
360000000000
240000000000
240000000000
-720000000000
420000000000
當輸出打印到csv時,我會得到相同的結果。
我如何:
處理這個輸出?
以'分鐘'格式打印輸出到csv?
句柄「準時」輸出?
謝謝!正在爲此而掙扎! – richie
僅供參考,反向操作尚未實現(讀取timedelta列);此列將被讀爲對象dtype – Jeff