0

How can I convert string column to datetime in pandas?

My columns is as follows

Date

01Jan2019
01Feb2019
01Mar2019

How can I convert this to a pandas date time?

5

2 Answers 2

1

The following code will convert your String column to datetime64

df['Date'] = pd.to_datetime(df['Date'], infer_datetime_format=True)
Sign up to request clarification or add additional context in comments.

Comments

0

Could you try with below code

from datetime import datetime
datetime_object =datetime.strptime('01Jan2019', '%d%b%Y')

1 Comment

The question is about Pandas, no?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.