I can split the dataframe df
into two parts like so:
predicate = pl.col("a").gt(pl.col("b"))
dfx = df.filter(predicate)
dfy = df.filter(~predicate)
This is wasteful, because we do not want/need to go through df
twice in order to produce dfx
and dfy
. Is there a better method?