[英]Converting Unix timestamp to timestamp including the local time of a certain timezone
I have following code:我有以下代码:
df['time'] = (pd.to_datetime(df['unix_time'], unit='s'))
df['time'] = (pd.to_datetime(df['unix_time'], unit='s',tz='Europe/Vienna'))
First line runs but when I try to set the new timestamp as a local time for that timezone I get an error as - **
to_datetime() got an unexpected keyword argument 'tz' **
第一行运行,但是当我尝试将新时间戳设置为该时区的本地时间时,我收到一个错误,因为 - **
to_datetime() 得到了一个意外的关键字参数 'tz' **
Thanks谢谢
pd.to_datetime(df['unix_time'], unit='s').tz_localize('Europe/Vienna')
或者
pd.to_datetime(df['unix_time'], unit='s',utc=True).tz_convert('Europe/Vienna')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.