Skip to content

Commit 0fa48a0

Browse files
committed
chore: Add missing cum_sum
1 parent d085b3a commit 0fa48a0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

narwhals/_plan/dummy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ def cum_max(self, *, reverse: bool = False) -> Self:
233233
def cum_prod(self, *, reverse: bool = False) -> Self:
234234
return self._from_ir(F.CumProd(reverse=reverse).to_function_expr(self._ir))
235235

236+
def cum_sum(self, *, reverse: bool = False) -> Self:
237+
return self._from_ir(F.CumSum(reverse=reverse).to_function_expr(self._ir))
238+
236239
def rolling_sum(
237240
self, window_size: int, *, min_samples: int | None = None, center: bool = False
238241
) -> Self:

narwhals/_plan/functions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ def __repr__(self) -> str:
202202
CumMin: "min",
203203
CumMax: "max",
204204
CumProd: "prod",
205+
CumSum: "sum",
205206
}
206207
return f"cum_{m[tp]}"
207208

@@ -241,6 +242,9 @@ class CumMax(CumAgg): ...
241242
class CumProd(CumAgg): ...
242243

243244

245+
class CumSum(CumAgg): ...
246+
247+
244248
class RollingSum(RollingWindow): ...
245249

246250

0 commit comments

Comments
 (0)