0
我想散點圖duration(mins)
與start
時間這樣的(這是一天的時間,無論什麼日期是上):我有熊貓散點圖與一天中的時間?
CSV文件commute.csv
看起來像這樣:
date, prediction, start, stop, duration, duration(mins), Day of week
14/08/2015, , 08:02:00, 08:22:00, 00:20:00, 20, Fri
25/08/2015, , 18:16:00, 18:27:00, 00:11:00, 11, Tue
26/08/2015, , 08:26:00, 08:46:00, 00:20:00, 20, Wed
26/08/2015, , 18:28:00, 18:46:00, 00:18:00, 18, Wed
我可以導入CSV文件,如下所示:
import pandas as pd
times = pd.read_csv('commute.csv', parse_dates=[[0, 2], [0, 3]], dayfirst=True)
times.head()
輸出:
date_start date_stop prediction duration duration(mins) Day of week
0 2015-08-14 08:02:00 2015-08-14 08:22:00 NaN 00:20:00 20 Fri
1 2015-08-25 18:16:00 2015-08-25 18:27:00 NaN 00:11:00 11 Tue
2 2015-08-26 08:26:00 2015-08-26 08:46:00 NaN 00:20:00 20 Wed
3 2015-08-26 18:28:00 2015-08-26 18:46:00 NaN 00:18:00 18 Wed
4 2015-08-28 08:37:00 2015-08-28 08:52:00 NaN 00:15:00 15 Fri
我現在努力繪製duration(mins)
與start
時間(無日期)。請幫忙!
@jezrael一直是一個很好的幫助... issue 8113的意見之一建議使用df.plot(x = x,y = y,style =「。」)的變體。我試了一下:
times.plot(x='start', y='duration(mins)', style='.')
然而,它並不顯示一樣我打算情節:輸出不正確,因爲X軸被拉長,使每個數據點是相同的相隔距離在X:
有沒有辦法與時間陰謀?