Time series scalers reject ragged lists despite variable-length support

Open
#751 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@sunlishuo25 is already working on this.

Since Oct 5, 2026.

  • #752 by @sunlishuo25 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
numpy, python

Research direction

Start by running the reproducer in the issue, then read the implementations of TimeSeriesScalerMinMax and TimeSeriesScalerMeanVariance and their existing tests. Check fit_transform, transform, and inverse_transform against the expected behavior for ragged input, including the stated validation checks. Done means ragged lists match the results from explicitly calling to_time_series_dataset; an open pull request is already linked.

Written by the indexing model from the issue text.

Description

Describe the bug
TimeSeriesScalerMinMax and TimeSeriesScalerMeanVariance reject a list containing time series of different lengths. The same data succeeds after explicitly calling to_time_series_dataset, and other variable-length preprocessors accept such lists directly.

To Reproduce

from tslearn.preprocessing import TimeSeriesScalerMinMax

TimeSeriesScalerMinMax().fit_transform([[1, 3], [5, 7, 9]])

This raises ValueError: setting an array element with a sequence ... inhomogeneous shape. The same problem affects TimeSeriesScalerMeanVariance, transform after fitting padded input, and inverse_transform with per_timeseries=False.

Expected behavior
Validate the individual time series, pad shorter series with NaN, and produce the same result as explicitly formatting the dataset first. Preserve fitted-state, feature-count and invalid-input checks.

Environment
macOS arm64, Python 3.11.9, tslearn 0.10.0.dev at 9ef74f9602a93057cb1e3e5fdb389e210a4f4f97, NumPy 2.4.6, scikit-learn 1.7.2.

Developed with GPT assistance

Dominant language
Python
Stars
3.2k
Forks
418
Avg merge
2d 14h
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tslearn-team/tslearn

All issues in tslearn-team/tslearn

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.