Transformer
PaddingTransformer
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.
Schnellstart
python
from sktime.transformations.padder import PaddingTransformer
estimator = PaddingTransformer(pad_length=None, fill_value=0)Parameter(1)
- pad_lengthint, optional (default=None) length to pad the series too.
- if None, will find the longest sequence and use instead.
Beispiele
>>> 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)