sktime icon indicating copy to clipboard operation
sktime copied to clipboard

[BUG] SlopeTransformer returns mulit-index pandas dataframe but not the original index labels.

Open twobitunicorn opened this issue 6 months ago • 9 comments

Describe the bug Applying the SlopeTransformer on a multi-index removes all index labels and replaces them with integers.

To Reproduce

import pandas as pd
from sktime.transformations.panel.slope import SlopeTransformer

X = pd.DataFrame(
    {
        "org": "skitime",
        "author": "franz",
        "date": pd.date_range("2022-08-08", "2022-08-12"),
        "values": [0.23, 0.40, 0.71, 0.81, 0.7],
    }
).set_index(["org", "author", "date"])
transformer = SlopeTransformer(2)
Xt = transformer.fit_transform(X)
Xt

Expected behavior A multi-index dataframe that contains the original index labels..

System: python: 3.12.4 (main, Aug 14 2024, 14:42:56) [Clang 15.0.0 (clang-1500.3.9.4)] executable: /Users/joseph/.pyenv/versions/3.12.4/bin/python machine: macOS-14.6.1-arm64-arm-64bit

Python dependencies: pip: 24.2 sktime: 0.32.1 sklearn: 1.5.1 skbase: 0.8.2 numpy: 1.26.4 scipy: 1.14.0 pandas: 2.2.2 matplotlib: 3.9.2 joblib: 1.4.2 numba: 0.60.0 statsmodels: 0.14.2 pmdarima: 2.0.4 statsforecast: 1.7.6 tsfresh: None tslearn: None torch: None tensorflow: None tensorflow_probability: None

twobitunicorn avatar Aug 21 '24 14:08 twobitunicorn