From the course: Data Analysis with Python and Pandas
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Formatting dates
From the course: Data Analysis with Python and Pandas
Formatting dates
- [Instructor] Okay, so when you were just looking at the Pandas to_datetime function, I mentioned that we could specify our own custom date formats. And to be honest, we don't tend to need to do this very often because most of the datetime formats we use are going to be commonly used throughout the world. But there are going to be times when you're reading in data from a certain source where it's a very specific type of format. And we might need to use these datetime codes to help us specify the format. So here we have quite a few formats. I'm just going to go through a few of these. So %D represents the zero-padded date. So anytime we have, for example, month, if it's a single digit month, it'll be padded with a zero. This date format's going to be based on your operating system settings. So because I'm based in the United States and we have a bit strange date format, we start with month, then go to day, then go to year as our default date setting. Some of these are going to be more…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Times in Python and pandas3m 8s
-
(Locked)
Converting to datetimes6m 16s
-
(Locked)
Formatting dates5m 20s
-
(Locked)
Date and time parts3m 4s
-
(Locked)
Challenge: pandas datetime basics1m 23s
-
(Locked)
Solution: pandas datetime basics2m 10s
-
(Locked)
Time deltas and arithmetic6m 54s
-
(Locked)
Challenge: Time deltas1m 10s
-
(Locked)
Solution: Time deltas1m 29s
-
(Locked)
Time series indices3m 58s
-
(Locked)
Missing time series data4m 45s
-
(Locked)
Challenge: Missing time series data1m 44s
-
(Locked)
Solution: Missing time series data2m 13s
-
(Locked)
Shifting time series3m 16s
-
(Locked)
Pro tip: diff()2m 54s
-
(Locked)
Challenge: shift() and diff()1m 39s
-
(Locked)
Solution: shift() and diff()2m 47s
-
(Locked)
Aggregation and resampling4m 6s
-
(Locked)
Challenge: Resampling41s
-
(Locked)
Solution: Resampling1m 53s
-
(Locked)
Rolling aggregations4m 35s
-
(Locked)
Challenge: Rolling aggregations45s
-
(Locked)
Solution: Rolling aggregations55s
-
(Locked)
Key takeaways1m 37s
-
(Locked)
-
-
-