如何根据城市名称将UTC时间转换为本地时间?
我有一个在UTC中有时间的熊猫数据框架。我还有另一列具有时区,我想将其转换为时区,
time, timezone
2022-06-23 01:00:00, Montevideo
2022-05-10 05:00:00, Brasilia
2022-07-16 22:47:00, Casablanca
我想根据时区列中的值将这些行中的每一行转换为各自的本地时间戳
I have a Pandas Dataframe that has time in UTC. I also have another column that has the timezone to which I would like to convert it to
time, timezone
2022-06-23 01:00:00, Montevideo
2022-05-10 05:00:00, Brasilia
2022-07-16 22:47:00, Casablanca
I would like to convert each of these rows into their respective local timestamp based on value in the timezone column
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
借助 geocoder ,这是这样做的一种方法:
With the help of Geocoder, here is one way to do it: