I am currently creating a new column in a polars data frame using
predictions = [10, 20, 30, 40, 50]
df['predictions'] = predictions
where predictions
is a numpy array or list containing values I computed with another tool.
However, polars throws a warning, that this option will be deprecated.
How can the same result be achieved using .with_columns()
?
The values in the numpy array or list predictions
can be add to a polars table using:
predictions = [10, 20, 30, 40, 50]
df.with_columns(pl.Series(name="predictions", values=predictions))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With