From 03db1ec085d5966f600ab43b573c27f7d4ca6def Mon Sep 17 00:00:00 2001 From: janrth Date: Sat, 15 Nov 2025 21:40:01 +0100 Subject: [PATCH] enable sparse matrix in reconcile --- hierarchicalforecast/core.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hierarchicalforecast/core.py b/hierarchicalforecast/core.py index 6af2420b..27fc3f40 100644 --- a/hierarchicalforecast/core.py +++ b/hierarchicalforecast/core.py @@ -419,12 +419,6 @@ def reconcile( S_nw_cols_ex_id_col = S_nw.columns S_nw_cols_ex_id_col.remove(id_col) if any_sparse: - if not nw.dependencies.is_pandas_dataframe( - Y_hat_df - ) or not nw.dependencies.is_pandas_dataframe(S_df): - raise ValueError( - "You have one or more sparse reconciliation methods. Please convert `S_df` and `Y_hat_df` to a pandas DataFrame." - ) try: S_for_sparse = sparse.csr_matrix( S_nw.select(nw.col(S_nw_cols_ex_id_col)).to_native().sparse.to_coo() @@ -437,10 +431,6 @@ def reconcile( ) if Y_nw is not None: - if any_sparse and not nw.dependencies.is_pandas_dataframe(Y_df): - raise ValueError( - "You have one or more sparse reconciliation methods. Please convert `Y_df` to a pandas DataFrame." - ) y_insample = self._prepare_Y( Y_nw=Y_nw, S_nw=S_nw,