Returns a Polars expression that assigns a label to each row based on its index, cycling through the provided items in a round-robin fashion.
bucketize_lit() is a simplified version of bucketize(), designed for common use cases involving literal values. For more advanced scenarios, consider using bucketize() directly.
Parameters
items:Any=()
Literal values to cycle through. You can provide these either as multiple separate arguments or as a single iterable containing the values. All items must be of the same type, and at least two items are required. See the table below for supported types and their conversions.
In the list namespace, it may be easier to think of each row as an element in a list. Conceptually, you’re working with a pl.Series, where each row corresponds to one item in the list.
Cycle through boolean values to mark alternating elements: