duration
Computes duration between two dates.
Usage
This calculator allows the user to compute the duration in days between 2 date.
This calculator can be used with the following method:
duration
Examples:
Compute the duration between the product launch date and the sale date.
Compute a promo period duration based on the start and the end date of the promo
Main Parameters
The bold options represent the default values when the parameters are optional.
input_columns list of columns used as input of the calculators: The list of columns that will be used to fill the output column.
output_columns list of columns added by the calculators : Name of the filled column added to the dataset.
global (true, false) Should this calculator be performed before data splitting during training for cross-validation
steps [optionnal] (training, prediction, postprocessing*)*** List of steps in a pipeline where columns from this calculator are added to the data. Note that when the training option is listed, the calculator is actually added during preprocessing.
store_in_model [optionnal] (true, false) Please indicate whether the "calculated" columns by the calculator should be stored in the model or not to avoid recalculating them during prediction. This is only relevant if the calculated columns are added to both training and prediction. Without this parameter, the values will not be stored in the model. The following parameters only make sense if this parameter is set to true.
stored_columns [required if store_in_model is true] List indicating the columns to be stored among the output_columns.
stored_keys [required if store_in_model is true] List indicating the columns to use for identifying the correct values to join on the data for prediction among the stored values (logically, they are to be chosen from the input_columns).
Specific Parameters
begin_date The name of the column containing the lower bound for days counting.
end_date The name of the column containing the upper bound for days counting.
Examples
Given dataset containing daily sales data of several products with the sales date (
receipt_date
) and the date when the product was launched (receipt_date
). The user want to get the number of days between the sale and the product launch.Result :
receipt_dateproduct_launchproduct_duration2023-01-01
2022-07-25
160
2023-01-02
2022-07-25
161
2023-01-03
2022-07-25
162
2023-01-01
2023-01-01
0
2023-01-02
2023-01-01
1
2023-01-03
2023-01-01
2
Last updated