Fix: the hisotgrams were adding lines with NaNs when the corresponding partition was completely empty. Now it is back to old behavior and no index is added for partitions completely empty.

This commit is contained in:
2025-08-21 11:37:23 +02:00
parent 063b01e73f
commit d7f778d531

View File

@@ -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