diff --git a/sktime/datatypes/_series/_check.py b/sktime/datatypes/_series/_check.py index ff3d900abf1..b58bbae8100 100644 --- a/sktime/datatypes/_series/_check.py +++ b/sktime/datatypes/_series/_check.py @@ -67,7 +67,7 @@ def check_pddataframe_series(obj, return_metadata=False, var_name="obj"): # pd.DataFrame mtype allows object dtype, # but if we allow object dtype with pd.Series entries, # the mtype becomes ambiguous, i.e., non-delineable from nested_univ - if len(obj) > 0 and isinstance(obj.iloc[0, 0], (pd.Series, pd.DataFrame)): + if np.prod(obj.shape) > 0 and isinstance(obj.iloc[0, 0], (pd.Series, pd.DataFrame)): msg = f"{var_name} cannot contain nested pd.Series or pd.DataFrame" return ret(False, msg, None, return_metadata)