Skip to content

Commit

Permalink
fix: make inf percent change result null (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-sentry authored Nov 19, 2024
1 parent ace92d6 commit 4a2bb9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion graphql_api/types/flake_aggregates/flake_aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def flake_aggregates_with_percentage(
merged_results: pl.DataFrame = pl.concat([past_aggregates, curr_aggregates])

merged_results = merged_results.with_columns(
pl.all().pct_change().fill_nan(0).name.suffix("_percent_change")
pl.all()
.pct_change()
.replace([float("inf"), float("-inf")], None)
.fill_nan(0)
.name.suffix("_percent_change")
)
aggregates = merged_results.row(1, named=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def test_results_aggregates_with_percentage(
# with_columns upserts the new columns, so if the name already exists it get overwritten
# otherwise it's just added
merged_results = merged_results.with_columns(
pl.all().pct_change().fill_nan(0).name.suffix("_percent_change")
pl.all()
.pct_change()
.replace([float("inf"), float("-inf")], None)
.fill_nan(0)
.name.suffix("_percent_change")
)
aggregates = merged_results.row(1, named=True)

Expand Down

0 comments on commit 4a2bb9b

Please sign in to comment.