Skip to Content

This component takes an incomplete daily time series and adds any missing dates. The measure can be approximated for the dates that have been added. Ensuring that such time series are complete can be important for charting or forecasting purposes.

Disclaimer

Please note that this component is not an official release by SAP and that it is provided as-is without any guarantee or support. Please test the component to ensure it works for your purposes.

Prerequisites

– R library zoo must be installed.

– The first column must hold the date stamp as String value.

– All remaining columns must be numerical values that can be approximated.

Limitations

Please let me know should you encounter any limitations.

Usage

These parameters can be set by the user.

Parameter Description
Date Format

Specifies the string column’s date format in R notation. For instance: %d.%m.%Y

See the documentation of the as.Date() function for the syntax.

Approximate Missing Values

True or False

Specifies whether the measure of the added dates will be approximated or left empty.

No output columns added by this component.

How to Implement

The component can be downloaded as .spar file from GitHub. Then deploy it as described here. You just need to import it through the option “Import/Model Component”, which you will find by clicking on the plus-sign at the bottom of the list of the available algorithms.

Example

You can try out the component wtih our own data or with the file ZurichTemperaturesWithMissingDates.csv. The dataset lists the maximum temperatures measured in Zurich, Switzerland, on a number of days. The file contains only two columns: the date and the temperature. However, some dates are missing in this dataset and we want to complete the time series by adding those missing dates.

Just start SAP Predictive Analysis and load the file ZurichTemperaturesWithMissingDates.csv. You will see the date and the maximum temperature measured on that day. You can also see, that for instance the 8th and 9th of November 2014 are missing.

screen0.PNG

In order to fill in the missing rows, go to the “Predict” tab and add the “Add Missing Dates” component to your workflow and configure it. Specify the date format and whether the measures of the added dates are to be approximated. For now keep the default and do not approximate.

screen1.PNG

Run the component and switch to the result view when prompted. You will see the that the time series is now complete. The missing dates have been added with an empty measure. You could now analyse the data further or write the results to a file or database.

screen2.PNG

However, we want to fill in the missing measures. In the component’s configuration change the value for “Approximate Missing Values” to True. Execute the component again. You will see how the missing values have now been filled by approximations of the surrounding values. The time series is complete.

screen3.PNG

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply