I have a pandas dataframe with some timestamp values in a column. I wish to get the sum of values grouped by every hour.
Date_and_Time Frequency
0 Jan 08 15:54:39 NaN
1 Jan 09 10:48:13 NaN
2 Jan 09 10:42:24 NaN
3 Jan 09 20:18:46 NaN
4 Jan 09 12:08:23 NaN
I started off removing the leading days in the column and then typed the following to convert the values to date_time compliant format:
dateTimeValues['Date_and_Time'] = pd.to_datetime(dateTimeValues['Date_and_Time'], format='%b %d %H:%M:%S')
After doing so, I receive the following error:
ValueError: time data 'Jan 08 12:41:' does not match format '%b %d %H:%M:%S' (match)
On checking my input CSV, I can confirm that no column containing the above data are incomplete.
I'd like to know how to resolve this issue and successfully process my timestamps to their desired output format.
question from:
https://stackoverflow.com/questions/65864234/timestamp-format-not-being-matched-in-pandas-to-datetime-format-specifier 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…