一開始使用df[‘TIME’] = parser.parse(df[‘GPS_TIME’]),出現錯誤,錯誤提示為:
Parser must be a string or character stream, not Series
df[‘GPS_TIME’]中的每個資料雖然是str,但df[‘GPS_TIME’]整體是Series,parse()需要str類型才能進行時間轉換,故不能直接用。
df[‘TIME’] =df[‘GPS_TIME’].apply(lambda x:parser.parse(x)),通過周遊對每個df[‘GPS_TIME’]中的每個資料進行時間轉換。