diff --git a/src/sp2xr/distribution.py b/src/sp2xr/distribution.py index f1ef593..fc0f956 100644 --- a/src/sp2xr/distribution.py +++ b/src/sp2xr/distribution.py @@ -259,10 +259,15 @@ def process_hist_and_dist_partition( # expand list-of-counts -> wide matrix (one col per bin) max_list_length = len(bin_ctrs) if df_resampled.empty: - # IMPORTANT: use the resampled time index so schema matches later joins + """# IMPORTANT: use the resampled time index so schema matches later joins idx = flow_dt.index columns = [f"result_{i}" for i in range(max_list_length)] - ddf_hist = pd.DataFrame(np.nan, columns=columns, index=idx) + ddf_hist = pd.DataFrame(np.nan, columns=columns, index=idx)""" + + ddf_hist = pd.DataFrame( + columns=[f"result_{i}" for i in range(max_list_length)], + index=pd.DatetimeIndex([], name=df.index.name), + ) else: ddf_hist = df_resampled["result"].apply(pd.Series) ddf_hist.index = df_resampled.index