41  Circular Features

When working with datetime features, there are a couple of instances where it is useful to work with them in a purely circular 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 circular features, see the Circular section.

To make things perfectly circular we need to work with regular units of seasonality. This is quite nice as we have the units that are going to guide the circular nature of the effects. This is unlike other types of circular 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 circular method in the Circular 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 circular 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