Let's say I have a simple two row df:
| date_column |
|----------------------|
|10/23/2001 12:34:44 AM|
|10/23/2001 12:33:44 |
|----------------------|
If I run the line:
df[date_column] = pd.to_datetime(df[date_colummn], format='%m/%d/%Y %H:%M:%S')
I get the error
'unconverted data remains'
but I am perfectly okay with the '%p'
missing, I just want to get the %m/%d/%Y
.
Is there any way to achieve this? Can I tell pandas to parse only the present data in my "format" and ignore the rest, if it's missing?
UDPATE
looks like this keyword, according to the doc might do the trick:
exact: bool, True by default
Behaves as: - If True, require an exact format match. - If False, allow the format to match anywhere in the target string.