I'm creating a datetime variable with pandas using pd.to_datetime()
The referenced dataframe only has the date (e.g. 31/12/2023) so the function returns it with time 00:00:00 (e.g. 31/12/2023 00:00:00) and now I want to set the time value individually with the replace()
function following the examples shown in these two SO posts (ex1, ex2), but that leads to an error: TypeError: replace() got an unexpected keyword argument 'hour'
Here is the code:
end = pd.to_datetime(df_end_date, dayfirst=True).replace(hour=23, minute=59)
The expression df_end_date has a single value, see screenshot (1) below or here.
The complete error message is shown in screenshot (2) below or here.
Screenshot (1):
Screenshot (2):