narwhals
narwhals copied to clipboard
enh: add `is_elementwise` and `returns_scalar` to `map_batches`
currently tracking metadata for map_batches is really awkward
we should probably add these two arguments, and raise if the function output doesn't match expectations
this should probably go in after https://github.com/narwhals-dev/narwhals/pull/2483
@MarcoGorelli since #2998 would bring us half way through this issue, I wonder how is_elementwise would look like for pandas-like and pyarrow. Or would we let it exist just for compatibility for non polars backends?
it would just affect the result's ExprMetadata