how to assign same value to multiple columns based on another column condition in python polars
df = pl.DataFrame({
"A": ["a", "b", "a", "c"],
"B": [23,45,60,50],
"C": [11, 26, 63, 84]
})
┌─────┬─────┬─────┐
│ A ┆ B ┆ C │
│ --- ┆ --- ┆ --- │
│ str ┆ i64 ┆ i64 │
╞═════╪═════╪═════╡
│ a ┆ 23 ┆ 11 │
│ b ┆ 45 ┆ 26 │
│ a ┆ 60 ┆ 63 │
│ c ┆ 50 ┆ 84 │
└─────┴─────┴─────┘
based on column A if value is "a" , then value for column B and C need to be set as 0
need output as
┌─────┬─────┬─────┐
│ A ┆ B ┆ C │
│ --- ┆ --- ┆ --- │
│ str ┆ i64 ┆ i64 │
╞═════╪═════╪═════╡
│ a ┆ 0 ┆ 0 │
│ b ┆ 45 ┆ 26 │
│ a ┆ 0 ┆ 0 │
│ c ┆ 50 ┆ 84 │
└─────┴─────┴─────┘