Lets say I have following DataFrame:
import pandas as pd
df = pd.DataFrame({"Date":["2022-01-01", "2022-01-02", "2022-01-03"], "Time":[0,1,10]})
I want another column which is a datetime using the Date and the Time Columns.
Expected result
Date Time DateTime
0 2022-01-01 0 2022-01-01 00:00:00
1 2022-01-02 1 2022-01-02 01:00:00
2 2022-01-03 10 2022-01-03 10:00:00
Trial
I tried this failed solution:
df["DateTime"] = str(df["Date"]) + " " + str(df["Time"]) + ":00"
Which outputs:
>>> df
Date Time DateTime
0 2022-01-01 0 0 2022-01-01\n1 2022-01-02\n2 2022-01...
1 2022-01-02 1 0 2022-01-01\n1 2022-01-02\n2 2022-01...
2 2022-01-03 10 0 2022-01-01\n1 2022-01-02\n2 2022-01...