Skip to content

Accept the documented k keyword in lag transforms - #275

Open
lllleolin-max wants to merge 1 commit into
matthewwardrop:mainfrom
lllleolin-max:codex/support-documented-lag-keyword
Open

lllleolin-max wants to merge 1 commit into
matthewwardrop:mainfrom
lllleolin-max:codex/support-documented-lag-keyword

Conversation

@lllleolin-max

Copy link
Copy Markdown

lag(x, k=2) raises TypeError for every supported input type because the public function calls its parameter k while the singledispatch implementations call it offset. Accept k consistently for pandas, NumPy and Narwhals; preserve the previously accepted offset keyword as an alias. Tests cover lag, lead, zero offsets, both keyword spellings, and use in a formula.

Validation: the added regression tests fail on main (81e675b) and pass with this patch. Related tests: python -m pytest tests/transforms/test_lag.py -q. Changed files pass ruff check and ruff format.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant