Skip to content

Commit

Permalink
fixed summary score bug with quantiles
Browse files Browse the repository at this point in the history
  • Loading branch information
nepslor committed Sep 24, 2024
1 parent 4615f87 commit 4e38958
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyforecaster/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ def scorer(estimator, X, y):

def summary_score(x, t, score=rmse, agg_index=None):
if len(x.shape) < 3:
if isinstance(x, pd.DataFrame) and isinstance(t, pd.DataFrame):
# if x is a pd.DataFrame and its columns are multiindex, just make sure t is a df
if isinstance(x, pd.DataFrame) and x.columns.nlevels > 1:
if not isinstance(t, pd.DataFrame):
t = pd.DataFrame(t, index=x.index)
elif isinstance(x, pd.DataFrame) and isinstance(t, pd.DataFrame):
x.columns = t.columns
elif isinstance(x, pd.DataFrame):
t = pd.DataFrame(t, index=x.index, columns=x.columns)
Expand Down

0 comments on commit 4e38958

Please sign in to comment.