I'm getting quite an unexpected behaviour using pandas' pd.to_datetime. My pd.Series is as follows:
0 2017-01-06 14:37:16
1 2017-01-27 00:00:00
2 2017-01-18 00:00:00
3 2017-01-26 00:00:00
4 None
...
454823 2019-10-22 11:20:03
454824 None
454825 2019-07-11 00:00:00
454826 None
454827 2019-07-15 00:00:00
Name: colx, Length: 454828, dtype: object
And when casting to datetime I'm getting:
pd.to_datetime(df.colx, errors='coerce')
InvalidIndexError: Reindexing only valid with uniquely valued Index objects
While this seems to indicate that there are duplicate values in the index, I ran the following tests to check if that was the cause:
all(df.colx.index == range(df.colx.shape[0]))
# True
df.index.duplicated().any()
# False
So apparently there aren't any duplicate indexes. What could be causing this error?