Skip to content

[Repo Assist] Add Series.before/after/startAt/endAt/between and Frame.rows* module functions (closes #191)#620

Merged
dsyme merged 2 commits intomasterfrom
repo-assist/fix-issue-191-series-slicing-functions-857b7fd423042502
Mar 14, 2026
Merged

[Repo Assist] Add Series.before/after/startAt/endAt/between and Frame.rows* module functions (closes #191)#620
dsyme merged 2 commits intomasterfrom
repo-assist/fix-issue-191-series-slicing-functions-857b7fd423042502

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Exposes the existing Series member slicing methods (Before, After, StartAt, EndAt, Between) as F#-style module functions, and adds matching Frame.rows* module functions for row range selection. Closes #191.

Motivation

The member methods have existed for a long time but were not available as Series.xxx pipe-able module functions, forcing users to mix member-call syntax (series.After(k)) with pipeline style in F# code. This is the gap called out in #191 ("It's irksome to mix |> and member styles at times").

New functions

Series module

Function Description Equivalent member
Series.after lowerExclusive series Keys strictly > bound series.After(k)
Series.before upperExclusive series Keys strictly < bound series.Before(k)
Series.startAt lowerInclusive series Keys >= bound series.StartAt(k)
Series.endAt upperInclusive series Keys <= bound series.EndAt(k)
Series.between lo hi series Keys in [lo, hi] series.Between(lo, hi)

Frame module

Function Description
Frame.rowsAfter lowerExclusive frame Row keys strictly > bound
Frame.rowsBefore upperExclusive frame Row keys strictly < bound
Frame.rowsStartAt lowerInclusive frame Row keys >= bound
Frame.rowsEndAt upperInclusive frame Row keys <= bound
Frame.rowsBetween lo hi frame Row keys in [lo, hi]

Usage

// Filter a price series to only 2024 data
let prices2024 = prices |> Series.startAt (DateTime(2024, 1, 1)) |> Series.endAt (DateTime(2024, 12, 31))
// Equivalent to:
let prices2024' = prices |> Series.between (DateTime(2024, 1, 1)) (DateTime(2024, 12, 31))

// Slice a frame to rows after a given date
let recent = df |> Frame.rowsAfter (DateTime(2024, 6, 1))

Implementation notes

  • All Series functions are thin wrappers that delegate to the existing member methods — zero added logic.
  • Frame functions call frame.GetSubrange(lo, hi) with the appropriate BoundaryBehavior options, consistent with how Frame.fs uses it internally.
  • Added open Deedle.Indices to FrameModule.fs to bring BoundaryBehavior into scope.

Test Status

All 500 tests pass (494 baseline + 6 new tests)

New tests added:

  • Series.after module function matches member After
  • Series.before module function matches member Before
  • Series.startAt module function matches member StartAt
  • Series.endAt module function matches member EndAt
  • Series.between module function returns inclusive range
  • Frame.rowsAfter, rowsBefore, rowsStartAt, rowsEndAt, rowsBetween work on ordered int keys

Generated by Repo Assist ·

To install this agentic workflow, run

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

…functions (closes #191)

Expose the existing Series member slicing methods (Before, After, StartAt, EndAt,
Between) as F#-style module functions in the Series module, enabling idiomatic pipe-
line usage. Add matching Frame.rowsBefore / rowsAfter / rowsStartAt / rowsEndAt /
rowsBetween module functions for frame row range selection.

Add 6 regression tests (5 for Series, 1 for Frame).

Co-authored-by: Copilot <[email protected]>
@dsyme dsyme marked this pull request as ready for review March 14, 2026 12:13
@dsyme dsyme merged commit e892ea1 into master Mar 14, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/fix-issue-191-series-slicing-functions-857b7fd423042502 branch March 14, 2026 12:13
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.

Add a few more F# style functions

1 participant