合并 pandas 中的日期和时间列
早上好,
我有一个关于将日期和时间列合并到 pandas 中的单个列的问题。
我的列的数据类型如下:
日期列:ytdsorted["Checkin\nDate"].dtype
输出:dtype('
时间列:ytdsorted["Checkin\nTime"].dtype
输出: dtype('O')
数据的预览如下:
日期列:ytdsorted["Checkin\nDate"].head(1)
输出:2021-10-01
时间列:ytdsorted["Checkin\nTime"].head(1)
输出:12:42 PM
我想合并日期和时间列,为我提供 24 小时格式:“yyyy-mm-dd hh:mm”
任何帮助将不胜感激!干杯
Good morning,
I have a question regarding combining date and time columns into a single column in pandas.
The data types of my columns are as follows:
Date column: ytdsorted["Checkin\nDate"].dtype
output: dtype('<M8[ns]')
Time column: ytdsorted["Checkin\nTime"].dtype
output: dtype('O')
A preview of how my data looks is as follows:
Date column: ytdsorted["Checkin\nDate"].head(1)
output: 2021-10-01
Time column: ytdsorted["Checkin\nTime"].head(1)
output: 12:42 PM
I would like to combine the date and time column to give me a 24hr format: "yyyy-mm-dd hh:mm"
Any help would be much appreciated! Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)