-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify documentation for the agg_list
argument in Expr.map_batches
#13612
Comments
It seems to be for map_elements. I don't think it has a practical usage outside of map_elements using it but I haven't messed with it much |
|
Sorry, to clarify, map_elements calls map_batches and in doing so it sets that parameter in different conditions that I don't remember off hand. |
Looks like it controls polars/crates/polars-plan/src/dsl/python_udf.rs Lines 209 to 210 in a8bdc76
Which is defined here: polars/crates/polars-plan/src/logical_plan/options.rs Lines 162 to 172 in a8bdc76
|
Does it actually do anything? I haven't been able to find an example where it changes the result. |
They have a clear distinction mainly in the Let's use an example to illustrate this further: df = pl.DataFrame(
{
"a": [0,1,0,1],
"b": [1,2,3,4],
}
)
def f(x):
print(x)
return x
df.group_by("a").agg(pl.col("b").map_batches(f, agg_list=False))
# first output
Series: '' [i64]
[
2
4
]
# second output
Series: '' [i64]
[
1
3
]
df.group_by("a").agg(pl.col("b").map_batches(f, agg_list=True))
# output
Series: 'b' [list[i64]]
[
[2, 4]
[1, 3]
] |
Maybe I can update this document to make it easier to understand. |
Description
The documentation for
Expr.map_batches
pithily describes the function of theagg_list
argument as"Aggregate list"
. What does this argument do? It would be good to update the documentation.The text was updated successfully, but these errors were encountered: