我有一个DataFrame:enter image description here
我想在本地时间显示"TimeStamps“,但不要运行。
time.localtime(data_user['TimeStamps'].astype(int))
错误:
TypeError: cannot convert the series to <class 'int'>
我怎样才能做到这一点呢?
发布于 2020-04-25 14:57:22
使用箭头包
from datetime import datetime
import arrow
now = datetime.utcnow()
print(arrow.get(now).to('local').format())
# 2020-04-25 15:55:31+01:00
如下所示:
def to_local(x):
return arrow.get(x).to('local').format()
data_user['TimeStamps']= data_user['TimeStamps'].apply(to_local)
https://stackoverflow.com/questions/61427475
复制相似问题