polars
polars copied to clipboard
Silent casting to the same categorical space in concat
Very nice library, enjoying using it every day very much.
Without pl.Config.set_global_string_cache() in concat polars silently cast second dataframe categorical namespace to the first. If it's possible it would be nice to have warning like in case of join.
import polars as pl
frames = [
pl.DataFrame([{"s": "1"}]),
pl.DataFrame([{"s": "2"}]),
]
pl.concat([
df.with_column(pl.col("s").cast(pl.Categorical))
for df in frames
])
s |
---|
cat |
"1" |
"1" |