From the course: Python for Marketing (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Resampling time series data

Resampling time series data - Python Tutorial

From the course: Python for Marketing (2019)

Resampling time series data

- [Narrator] Let's talk about resampling timeseries data. Resampling allows you to take a data set that you've got and sample it, for example, weekly, monthly, quarterly, yearly. So if you only have daily data and you want an easy way of rounding up the data into weekly data, into monthly data and quarterly or yearly, then resampling allows you to do that. So you pass the resample function and then you either add the sum or the mean or the standard deviation, whatever you want to look at, that's how easy it is to resample your data using pandas. And we're going to do a couple examples, One with month and one with quarterly. So to start we create a variable, 'cause we want to make our code reusable. Maybe we want to use ga_page data frequently or use it on other data sets. And then we pass the data frame and use a .resample method. And within that we pass M which stands for month, and in this case we're looking for the mean,…

Contents