Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorKraevTransferwise committed Nov 25, 2024
1 parent 0cd1f50 commit 08d7dca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_time_series_tree_solver(fit_sizes: bool):
sf = explain_timeseries(
df=data.data,
dims=data.dimensions,
max_segments=7,
num_segments=7,
max_depth=2,
total_name=data.segment_total,
size_name=data.segment_size,
Expand Down
2 changes: 2 additions & 0 deletions wise_pizza/solve/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def tree_solver(
"""

df = dim_df.copy().reset_index(drop=True)
if "total_adjustment" not in df.columns:
df["total_adjustment"] = 0.0
df["totals"] -= df["total_adjustment"]
df["__avg"] = df["totals"] / df["weights"]
df["__avg"] = df["__avg"].fillna(df["__avg"].mean())
Expand Down

0 comments on commit 08d7dca

Please sign in to comment.