Convert to DateTime

preview_player
Показать описание
In this video we go over how to convert pandas String objects to DataTime objects and how automatically convert to DateTime when reading in data.

Did you find this video helpful? Consider subscribing for weekly tips, tricks, and tutorials.

Convert string objects to numeric

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
$15 off Annual Dataquest subscription
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Data

0:00 Intro
0:12 Data
0:47 Convert to Date
1:30 Potential issues
3:50 Convert to DateTime
4:43 Read in DateTime data

If you do not convert dates to DateTime you may get an error like this:
AttributeError: Can only use .dt accessor with datetimelike values
Рекомендации по теме
Комментарии
Автор

it's easy to understand how you explain it

maganrodeo
Автор

You literally gave me the answer I needed within one minute. I had been struggling with this code all day trying to figure out the correct way. I kept getting an error. Thank you and I have Subscribed to your channel.

rodneywalker
Автор

Great video! Really like the way you simplified the process. Good job!👍

okiemute
Автор

Wonderful video with a great explanation and got the answers.

Mufc_maddy
Автор

Thanks a lot. I got struggle this problem for many days

gittichetkhomruthai
Автор

Hope you cover topics like create date from multiple columns, date parts extraction, date differences, and many more in the future. Date handling is a common and complicated topic and your explanations could help many others. I know you are good at this. Thanks again.

mahboobalam
Автор

Dude, you are just awesome.
Love from India 💖

ssssahil
Автор

How do i convert the date into a Quarter(ly) column

dianacastro
Автор

Hi, do you know how to convert numbers into hours - minutes - seconds, like 150000 to 15:00:00?

I tried df['Time'] = pd.to_datetime(df['Time']), and the result turned out to be 1970-01-01 00:00:00

If adding format = '%H%M%S', then it becomes 1900-01-01 15:00:00

The first one is far from what I need, the second one is partly right for it changes from 150000 into 15:00:00

Dtypes shows its type is int64.

Appreciated if you could show me a clue.

barusu
Автор

Hello, great explanation. Is a way to contact you directly for pay coach, i have a project to do and i need help?

sandrabarros