41  Periodic Features

When working with datetime features, there are a couple of instances where it is useful to work with them in a purely periodic sense. We will cover those instances and why we would want to do it in this chapter. For a broader and more comprehensive look at how to work with periodic features, see the periodic section.

To make things perfectly periodic we need to work with regular units of seasonality. This is quite nice as we have the units that are going to guide the periodic nature of the effects. This is unlike other types of periodic data where we need to find the scale of the period.

We can work with things like hours, days and weeks directly. But we need to take extra care when working with uneven periods such as months and years, since the months are not all the same length, and leap years exist. One way to deal with this is to work with the decimal representation.

Once we have the datetime variables in the right format, all we have to do is find an appropriate periodic method in the periodic section and apply it.

TODO

Wait for recipes step to show how this would look

41.2 Pros and Cons

41.2.1 Pros

  • The nature of datetime variables naturally leads to periodic patterns

41.2.2 Cons

  • Extra care and work need to be done to find the right period

41.3 R Examples

TODO

Add recipes steps

41.4 Python Examples