Skip to content

[Repo Assist] Add Stats.levelMin and Stats.levelMax to F# API#647

Merged
dsyme merged 3 commits intomasterfrom
repo-assist/improve-level-min-max-1baabdd194ea1b96
Mar 18, 2026
Merged

[Repo Assist] Add Stats.levelMin and Stats.levelMax to F# API#647
dsyme merged 3 commits intomasterfrom
repo-assist/improve-level-min-max-1baabdd194ea1b96

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Repo Assist — coding improvement (Task 5).

Summary

Stats.levelMin and Stats.levelMax were missing from the F# Stats module, creating an asymmetry with the C# extension methods MinLevel/MaxLevel (which already existed in SeriesStatsExtensions).

This PR adds the two missing functions, completing the set of level-aggregation statistics alongside levelMean, levelMedian, levelSum, levelCount, levelStdDev, levelVariance, levelSkew, and levelKurt.

Changes

src/Deedle/Stats.fs — two new one-liner functions:

Stats.levelMin (level:'K -> 'L) (series:Series<'K, 'V>) : Series<'L, float>
Stats.levelMax (level:'K -> 'L) (series:Series<'K, 'V>) : Series<'L, float>

Both follow the exact existing pattern (Series.applyLevel level Stats.min/max). Return NaN for groups with no non-missing values, consistent with Stats.min / Stats.max.

tests/Deedle.Tests/Stats.fs — 4 new assertions added to the existing Basic level statistics works on sample input test.

Why is this a good change?

  • Fills a genuine gap: F# users wanting to compute per-level min/max had no idiomatic path. C# users could use MinLevel/MaxLevel; F# users had to roll their own with Series.applyLevel.
  • Zero risk: two trivial one-liners mirroring existing level functions; no new logic.
  • No new dependencies.

Test Status

✅ All 612 existing tests pass on Linux (dotnet test tests/Deedle.Tests/Deedle.Tests.fsproj -c Release).

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@30f2254f2a7a944da1224df45d181a3f8faefd0d

The C# extension methods MinLevel/MaxLevel (in SeriesStatsExtensions)
already existed but the equivalent Stats.levelMin and Stats.levelMax
were missing from the F# Stats module, creating an asymmetry.

Both functions follow the exact same pattern as existing level stats
(levelMean, levelMedian, levelSkew, etc.) using Series.applyLevel.
They return NaN for groups with no non-missing values, consistent with
Stats.min / Stats.max.

Tests: 4 new assertions in 'Basic level statistics works on sample input'.
All 612 existing tests continue to pass.

Co-authored-by: Copilot <[email protected]>
@dsyme dsyme marked this pull request as ready for review March 18, 2026 15:14
@dsyme dsyme merged commit d502c8f into master Mar 18, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/improve-level-min-max-1baabdd194ea1b96 branch March 18, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant