Back to models
Transformer

PaddingTransformer

MultivariateUnequal-length seriesEqualizes series length

Padding panel of unequal length time series to equal, fixed length.

Pads the input dataset to either a optional fixed length (longer than the longest series). Or finds the max length series across all series and dimensions and pads to that with zeroes.

Quickstart

python
from sktime.transformations.padder import PaddingTransformer

estimator = PaddingTransformer(pad_length=None, fill_value=0)

Tags

Capabilities

  • Multivariate
  • Unequal-length series
  • Equalizes series length: Supported
  • Inverse transform: Not supported
  • Missing values: Not supported
  • Removes missing values: Not supported

Properties

Input typescitype:transform-input
Series
Output typescitype:transform-output
Series
Label typescitype:transform-labels
None
Fit is emptyfit_is_empty
No
Keeps the time indextransform-returns-same-time-index
No
Requires Xrequires_X
Yes
Requires yrequires_y
No
X and y need the same indexX-y-must-have-same-index
No

Parameters(1)

pad_lengthint, optional (default=None) length to pad the series too.
if None, will find the longest sequence and use instead.

Examples

>>> import pandas as pd
>>> from sktime.transformations.padder import PaddingTransformer
>>> 
>>> # Create a sample nested DataFrame with unequal length time series
>>> data = {
... 'feature1': [
... pd. Series ([1, 2, 3 ]), pd. Series ([4, 5 ]), pd. Series ([6, 7, 8, 9 ])
... ],
... 'feature2': [
... pd. Series ([10, 11 ]), pd. Series ([12, 13, 14 ]), pd. Series ([15 ])
... ]
... }
>>> X = pd. DataFrame (data)
>>> 
>>> # Initialize the PaddingTransformer
>>> padder = PaddingTransformer ()
>>> 
>>> # Fit the transformer to the data
>>> padder. fit (X) PaddingTransformer()
>>> 
>>> # Transform the data
>>> Xt = padder. transform (X)
>>> 
>>> # Display the transformed data
>>> # print(Xt)