From the course: Data Analysis with Python and Pandas
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Solution: Missing time series data
From the course: Data Analysis with Python and Pandas
Solution: Missing time series data
- [Instructor] All right, everybody, our Solution Code is up on the right. Let's go ahead and dive into the notebook. All right, so this required a little bit of combination of our missing value methods as well as our date filtering. So, our initial analysis got us here. We had our date index, we had the mean of our oil series, which is 67.71, and we had this plot with gaps in it. We then wanted to take a look at our means here with forward fill, backfill, and interpolate. We can go ahead and do this with a single call to the print function. It's not super pretty, but if we're just looking for quick numbers, we get 67.671 for forward fill, we get 67.673 for backfill, and we get 67.66 for interpolate. So, all of these are very close, and so we didn't have that many missing values, so the ability of single values modified to change our overall mean is quite low in this case. And so just remember that we had a 4 cent difference from not doing anything, so calculating the mean on our…
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)
-
-
-