79790913

Date: 2025-10-15 07:59:28
Score: 1
Natty:
Report link

.over for pandas is implemented via groupby operation, in which we only support elementary expressions (as we want to avoid running .groupby(...).apply(...) for the user).

One workaround is to split it into two chained over statements:

(
    pd_df
    .with_columns(x = nw.col('x').cum_sum().over('group'))
    .with_columns(x = nw.col('x').shift(1).over('group'))
)

I am not sure we will be able to support complex expressions.


linking because the tag doesn't exist on stackoverflow yet

Fun fact: SO doesn't let me create a narwhals tag as there is a narwhal one and they are too similar. Should I create python-narwhals?

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: FBruzzesi