'Combine date and time column in pandas

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



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source