一开始使用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’]中的每个数据进行时间转换。
解决报错:Parser must be a string or character stream, not Series
最新推荐文章于 2024-03-18 10:08:23 发布