keep_name() not getting replaced name.keep()
polars source version: 0.18.3
polars target version: 0.20.14
polars_upgrade version: 0.3.1
Instance 1:
Code: df = (df.with_columns(plcs.by_dtype(pl.Null).cast(pl.Utf8).keep_name()))
Expected result: df = (df.with_columns(plcs.by_dtype(pl.Null).cast(pl.Utf8).name.keep()))
Actual Result: No change
Instance 2:
# cols is a pl.Expr
Code: return cols.keep_name() if kwargs.get('keep_name') else cols
Expected result: return cols.name.keep() if kwargs.get('keep_name') else cols
Actual Result: No change
I think the second one is too risky to do statically
for the first one, did you do import polars.selectors as plcs?
I think the second one is too risky to do statically
for the first one, did you do
import polars.selectors as plcs?
Yes @ plcs.
For the second one: risky because keep_name() could be a function name being used by some other library, and there's no way to know that cols is a polars Expr?
there's no way to know that cols is a polars Expr
that's it, polars-upgrade just does static analysis - not saying it's not possible, but it would be quite tricky without doing a more involved analysis