Skip to content

pl.repeat does not throw error when either argument is more than 1 row #22069

@coastalwhite

Description

@coastalwhite

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

import polars as pl
pl.select(
    a = pl.repeat(pl.lit(pl.Series('a', ["1", "a", "a"])), 4),
    b = pl.repeat(42, pl.lit(pl.Series('a', [4, 2, 1])))
)

Log output

shape: (4, 2)
+-----+-----+
| a   | b   |
| --- | --- |
| str | i32 |
+===========+
| 1   | 42  |
|-----+-----|
| 1   | 42  |
|-----+-----|
| 1   | 42  |
|-----+-----|
| 1   | 42  |
+-----+-----+

Issue description

It is always treated like a scalar, but no error is thrown if you don't give a scalar.

Expected behavior

This should throw an error similar to how e.g. .index_of does for its second argument.

Installed versions

Replace this line with the output of pl.show_versions(). Leave the backticks in place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageAwaiting prioritization by a maintainerpythonRelated to Python Polars

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions