I want to convert the date column in dataframe with different formats to python datetime. The function pd.to_datetime(df['date'], infer_datetime_format=True) is working only till year 3000.
Please find below the example import pandas as pd
#Create the pandas DataFrame
data = [['A', '2021-08-08'], ['B', '2021/08/08'], ['C', '3031-08-08']]
df = pd.DataFrame(data, columns = ['Name', 'Date'])
| Name | Date | 
|---|---|
| A | 2021-08-08 | 
| B | 2021/08/08 | 
| C | 3031-08-08 | 
- pd.to_datetime(df['Date']) # giving errors
OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 3031-08-08 00:00:00
- pd.to_datetime(df['Date'], errors = 'coerce') # converting year beyond 3000 to NaT
| Name | Date | 
|---|---|
| A | 2021-08-08 | 
| B | 2021-08-08 | 
| C | NaT | 
Any solutions?
 
    