1

I have a pd.multiindex which looks like this: enter image description here

However, when I use the run check_raise(df_train, mtype="pd-multiindex)"

I get the following error:

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sktime/datatypes/_check.py:252, in check_raise(obj, mtype, scitype, var_name) 250 return True 251 else: --> 252 raise TypeError(msg)

TypeError: input.loc[i] must be Series of mtype pd.DataFrame, not at i=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]

I believe this means I am meant to convert each row into a pandas series, but I am unsure if this is correct?

Any help would be appreciated.

Sean
  • 119
  • 6
  • In [this example](https://github.com/sktime/sktime/blob/main/examples/AA_datatypes_and_datasets.ipynb), the time index column should be Int64Index, RangeIndex, DatetimeIndex, PeriodIndex. Yours is a float, so I'm guessing you might need to convert it to int or time. – James B Nov 28 '22 at 07:07

1 Answers1

0

I have similar issue, try to check if your index have duplicate keys, in your case:

df_train.reset_index(['sbj', 'system_time_stamp'])[['sbj', 'system_time_stamp']].duplicated(keep=False)

Remove duplicated index works for me.

allenyllee
  • 964
  • 1
  • 13
  • 16
  • I should of updated this a few weeks back but this was exactly how I solved it too :) – Sean Dec 11 '22 at 18:22