We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
pl.DataFrame({"a": [2, 3, 4]}).select(pl.lit("*").repeat_by(pl.col("a")))
ComputeError: Length of repeat_by argument needs to be 1 or equal to the length of the Series. Series length 1, by length 3
Expect to return a series of lists where the * literal is repeated by column a
--------Version info--------- Polars: 0.18.4 Index type: UInt32 Platform: macOS-13.3.1-arm64-arm-64bit Python: 3.10.5 (main, Sep 6 2022, 09:52:19) [Clang 13.1.6 (clang-1316.0.21.2.5)] ----Optional dependencies---- numpy: 1.23.4 pandas: 2.0.0 pyarrow: 10.0.0 connectorx: <not installed> deltalake: <not installed> fsspec: <not installed> matplotlib: 3.6.2 xlsx2csv: <not installed> xlsxwriter: <not installed>``` </details>
The text was updated successfully, but these errors were encountered:
This is intended. See #6360
To make it work as expected, create the column first like this:
( pl.DataFrame({"a": [2, 3, 4]}) .with_columns(s=pl.lit('*')) .select(pl.col('s').repeat_by(pl.col('a'))) )
Sorry, something went wrong.
Just browsing old issues, this was implemented in #10735 and can be closed.
pl.DataFrame({"a": [2, 3, 4]}).select(pl.lit("*").repeat_by(pl.col("a"))) # shape: (3, 1) # ┌───────────────────┐ # │ literal │ # │ --- │ # │ list[str] │ # ╞═══════════════════╡ # │ ["*", "*"] │ # │ ["*", "*", "*"] │ # │ ["*", "*", … "*"] │ # └───────────────────┘
@stinodego can be closed
No branches or pull requests
Checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Reproducible example
Issue description
ComputeError: Length of repeat_by argument needs to be 1 or equal to the length of the Series. Series length 1, by length 3
Expected behavior
Expect to return a series of lists where the * literal is repeated by column a
Installed versions
The text was updated successfully, but these errors were encountered: