I have a dataframe df and has a column by name timeframe of dtype object
column_a | timeframe |
---|---|
One | nov-21 |
Two | jun-90 |
I would like to convert timeframe column to date type but this conversion fails with error Out of bounds nanosecond timestamp: 1-11-21 00:00:00
df['timeframe'] = pd.to_datetime(df['Date'])
CodePudding user response:
Specify the format:
df['timeframe'] = pd.to_datetime(df['timeframe'], format="%b-%y", errors="coerce")