Repository: sktime/sktime

Issue:
[BUG] `transform` method of `MSTL` transformer does not work.
**Describe the bug**
<!--
A clear and concise description of what the bug is.
-->
transform method of the MSTL transformer returns an error.
**To Reproduce**
<!--
Add a Minimal, Complete, and Verifiable example (for more details, see e.g. https://stackoverflow.com/help/mcve

If the code is too long, feel free to put it in a public gist and link it in the issue: https://gist.github.com
-->

```python
import matplotlib.pyplot as plt  
from sktime.datasets import load_airline
from mstl import MSTL

y = load_airline()
y.index = y.index.to_timestamp()
mstl = MSTL(periods=[3,12] ,return_components=True)  
fitted = mstl.fit(y) 
res = fitted.transform(y)  
```

**Expected behavior**
<!--
A clear and concise description of what you expected to happen.
-->
Should not return an error. 
**Additional context**
<!--
Add any other context about the problem here.
-->
The error :
```
AttributeError                            Traceback (most recent call last)
[/tmp/ipykernel_30502/401942411.py](https://file+.vscode-resource.vscode-cdn.net/tmp/ipykernel_30502/401942411.py) in ?()
      5 y = load_airline()
      6 y.index = y.index.to_timestamp()
      7 mstl = MSTL(periods=[3,12] ,return_components=True)
      8 fitted = mstl.fit(y)
----> 9 res = fitted.transform(y)

[~/sktime/sktime/transformations/base.py](https://file+.vscode-resource.vscode-cdn.net/home/abhay/sktime/sktime/transformations/series/detrend/~/sktime/sktime/transformations/base.py) in ?(self, X, y)
    586         # input check and conversion for X/y
    587         X_inner, y_inner, metadata = self._check_X_y(X=X, y=y, return_metadata=True)
    588 
    589         if not isinstance(X_inner, VectorizedDF):
--> 590             Xt = self._transform(X=X_inner, y=y_inner)
    591         else:
    592             # otherwise we call the vectorized version of predict
    593             Xt = self._vectorize("transform", X=X_inner, y=y_inner)

[~/sktime/sktime/transformations/series/detrend/mstl.py](https://file+.vscode-resource.vscode-cdn.net/home/abhay/sktime/sktime/transformations/series/detrend/~/sktime/sktime/transformations/series/detrend/mstl.py) in ?(self, X, y)
    191             ).fit()
    192 
    193             ret_obj = self._make_return_object(X_full, new_mstl)
    194         else:
--> 195             ret_obj = self._make_return_object(X, self.mstl_)
...
   5987         ):
   5988             return self[name]
-> 5989         return object.__getattribute__(self, name)

AttributeError: 'DataFrame' object has no attribute 'iteritems'
```
**Versions**
<details>

<!--
Please run the following code snippet and paste the output here:

from sktime import show_versions; show_versions()
-->
System:
python: 3.10.12 (main, Jul  5 2023, 18:54:27) [GCC 11.2.0]
/python)
machine: Linux-6.5.0-18-generic-x86_64-with-glibc2.35

Python dependencies:
          pip: 23.2.1
       sktime: 0.26.0
      sklearn: 1.3.2
       skbase: 0.5.1
        numpy: 1.24.3
        scipy: 1.11.3
       pandas: 2.0.2
   matplotlib: 3.7.2
       joblib: 1.3.2
        numba: 0.58.1
  statsmodels: 0.14.0
     pmdarima: 2.0.3
statsforecast: 1.5.0
      tsfresh: 0.20.1
      tslearn: 0.5.3.2
        torch: None
   tensorflow: 2.13.0
tensorflow_probability: None
</details>

<!-- Thanks for contributing! -->



Discussion:
On further checking I have noticed that the error is due to the use of the `iteritems()` function which has been removed in pandas 2.0. I think the issue will be solved by simply replacing it with the equivalent `items()` function.

Resolving patch:
diff --git a/sktime/transformations/series/detrend/mstl.py b/sktime/transformations/series/detrend/mstl.py
--- a/sktime/transformations/series/detrend/mstl.py
+++ b/sktime/transformations/series/detrend/mstl.py
@@ -222,7 +222,7 @@ def _make_return_object(self, X, mstl):
                 "resid": resid,
             }
 
-            for column_name, column_data in mstl.seasonal.iteritems():
+            for column_name, column_data in mstl.seasonal.items():
                 ret[column_name] = column_data
 
             ret = pd.DataFrame(ret)
@@ -261,5 +261,9 @@ def get_test_params(cls, parameter_set="default"):
             "iterate": 10,
             "stl_kwargs": {"trend_deg": 0},
         }
+        params3 = {
+            "periods": [3, 12],
+            "return_components": True,
+        }
 
-        return [params1, params2]
+        return [params1, params2, params3]


Test patch: