如何使用生成散點圖timestamps?以下是一個示例,但出現錯誤 ValueError: First argument must be a sequenceimport pandas as pdimport matplotlib.pyplot as pltd = ({ 'A' : ['08:00:00','08:10:00'], 'B' : ['1','2'], })df = pd.DataFrame(data=d)fig = plt.figure()x = df['A']y = df['B']plt.scatter(x,y)如果我將時間戳轉換為總秒數,則可以使用:df['A'] = pd.to_timedelta(df['A'], errors="coerce").dt.total_seconds()但是我希望24小時是在x軸上,而不是總秒數。
添加回答
舉報
0/150
提交
取消