Closed marton78 closed 3 weeks ago
Can reproduce.
It seems to be an issue with null + structs?
pl.select(pl.lit(None).fill_null(pl.struct(42)))
# PanicException: not implemented for dtype Unknown(Int(42))
It does seem possible to force the type in a couple of ways, but it's not ideal:
df.select(
pl.when(pl.col.index == 1)
.then(pl.struct("place", 42))
.otherwise(
pl.struct(place=pl.lit(None, dtype=pl.String), literal=pl.lit(None, dtype=pl.Int32))
)
)
df.select(
(pl.col('index') == 1).replace(
old=False, new=None, default=pl.struct("place", 42)
)
)
# shape: (3, 1)
# ┌──────────────┐
# │ place │
# │ --- │
# │ struct[2] │
# ╞══════════════╡
# │ {null,null} │
# │ {"Earth",42} │
# │ {null,null} │
# └──────────────┘
Thanks for the proposed workarounds, @cmdlineluser, those will keep me afloat in the meantime!
Checks
Reproducible example
Log output
Issue description
This works:
Expected behavior
It should return:
Installed versions