我的数据框中有以下格式的时间:
print(df)
Date
2020-09-25T00:20:00.000Z
两个问题: a) 这是什么格式? b) 如何创建一个包含澳大利亚时间 (AEDT) 日期和时间的新列。
任何帮助都会很棒! 谢谢
最佳答案
这是什么格式?
检查 link :
The T doesn't really stand for anything. It is just the separator that the ISO 8601 combined date-time format requires. You can read it as an abbreviation for Time.
The Z stands for the Zero timezone, as it is offset by 0 from the Coordinated Universal Time (UTC).
如何使用澳大利亚时间 (AEDT) 的日期和时间创建新列?
将列转换为日期时间,然后使用 Series.dt.tz_convert
:
df['Date'] = pd.to_datetime(df['Date']).dt.tz_convert('Australia/Sydney')
print (df)
Date
0 2020-09-25 10:20:00+10:00
关于python - 如何在 Pandas 数据框中转换时间 2020-09-25T00 :20:00. 000Z,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64023330/