TimeResamplerConverter
Put a dated table on a regular calendar grid, one row per period.
Almost every forecasting model assumes the series it is given is a value per period with no period missing and none repeated. Real data rarely arrives that way: a shop closes on Sunday, a sensor drops out for two days, two readings land on the same afternoon. ARIMA and exponential smoothing read such a table by position, so a missing week silently shortens the calendar and every seasonal claim after it is wrong.
This converter rebuilds the table on the grid the user names. Rows falling in the same period are reduced by the chosen aggregation, periods the data never covered appear as their own rows, and the fill setting decides what those rows hold. Leaving them empty is honest and refused by most models; carrying the previous value forward suits a stock level; interpolating suits a smooth physical measurement; zero suits a count of events that simply did not happen.
The date column keeps its name and its format, so the result is still a
dated table that ForecastingTask and the exploration side can read.
Columns that are neither the date nor numeric are dropped, since there is
no meaningful way to average a piece of text over a week.
Parameters
- frequency : string, default=
day - The calendar grid to put the rows on: one row per day, week, month, quarter or year.
- aggregation : string, default=
mean - How several readings falling in the same period are reduced to the single value of that period.
- fill : string, default=
none - What to write into a period the data never covered: nothing, the previous value, the next value, a straight line between the two, or zero.
Methods
fit(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'TimeResamplerConverter'
TimeResamplerConverterIdentify the date column and the numeric columns to aggregate.
Parameters
- x : DashAIDataset
- The scoped columns. Exactly one must be a
Date. - y : DashAIDataset, optional
- Ignored. Defaults to None.
Returns
- TimeResamplerConverter
- The fitted converter instance (self).
get_output_type(self, column_name: str = None) -> DashAI.back.types.dashai_data_type.DashAIDataType
TimeResamplerConverterReturn the type of one column of the resampled table.
Parameters
- column_name : str, optional
- Name of the output column. Defaults to None.
Returns
- DashAIDataType
Datefor the date column,Integerfor an integer column that stayed exact through the aggregation and the fill, andFloatfor every other numeric column.
transform(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'DashAIDataset'
TimeResamplerConverterRebuild the table with one row per period of the chosen grid.
Parameters
- x : DashAIDataset
- The dataset to transform.
- y : DashAIDataset, optional
- Ignored. Defaults to None.
Returns
- DashAIDataset
- The date column followed by the aggregated numeric columns, one row per period from the first date to the last, in chronological order.
get_credential(self, name: str)
ConfigObjectResolve a registered credential component by name.
Parameters
- name : str
- Credential component class name (e.g. "HuggingFaceCredential").
Returns
- BaseCredential
- An instance of the requested credential component.
get_metadata(cls) -> 'Dict[str, Any]'
BaseConverterGet metadata for the converter, used by the DashAI frontend.
Parameters
- cls : type
- The converter class (injected automatically by Python for classmethods).
Returns
- Dict[str, Any]
- Dictionary containing display name, short description, image preview path, category, icon, color, and whether the converter is supervised.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.
Parameters
- raw_data : dict
- A dictionary with the data provided by the user to initialize the model.
Returns
- dict
- A validated dictionary with the necessary objects.