I am new to python polars and trying to convert the following pandas code to polars.
df.apply(lambda x: x[“obj”].compute(data), axis=1, expand = True)
Column obj in the dataframe df is composed of objects having a function property named compute. data is an external variable in the above code.
When I try the above code using polars,
dl.apply(lambda x: (x[0].compute(data)))
dl is the polars dataframe where the objects are stored in the first column, i.e 0.
I received the following error message:
‘Expr’ object doesn’t have compute property.
I am also not sure if polars have the expand feature.
Can you please help me how I can convert the above pandas apply to polars apply?
Thank you.