Datespine

This transform generates a date spine for your date index, which can replace your date index column for modeling.

All intervals are considered to be start-inclusive and end-exclusive, or [start, end]. The join with the date spine will be an outer join such that all intervals are present and all data that does not fall into one of those intervals is excluded.

If start_timestamp or end_timestamp are left blank, they will be automatically generated as the min or max timestamp in the 'date_col' column.

It's essentially:

SELECT user_table.*, intervals.*
FROM intervals
  LEFT JOIN user_table
  ON ...

Parameters

Example

ds = rasgo.get.dataset(74)

ds2 = ds.datespine(
    date_col='ORDERDATE',
    start_timestamp='2017-01-01',
    end_timestamp='2020-01-01',
    interval_type='month'
)
ds2.preview()

Source Code

Last updated