I have a dataframe where year, month, day, hour is split into separate columns:
df.head()
    Year   Month   Day  Hour
0   2020   1       1    0
1   2020   1       1    1
2   2020   1       1    2
   ...
I'd like to add a proper datetime column to the dataframe so I end up with something along these lines:
df.head()
    Year   Month   Day  Hour datetime
0   2020   1       1    0    2020-01-01T00:00
1   2020   1       1    1    2020-01-01T01:00
2   2020   1       1    2    2020-01-01T02:00
   ...
I could add a loop that processes one row at a time, but that's not panda-esque. Here are three things that don't work (not that I expected any of them to do so):
df['datetime'] = pd.to_datetime(datetime.datetime(df['Year'], df['Month'], df['Day'], df['Hour']))
df['datetime'] = pd.to_datetime(df['Year'], df['Month'], df['Day'], df['Hour'])
df['datetime'] = pd.datetime(df['Year'], df['Month'], df['Day'], df['Hour'])