marimo icon indicating copy to clipboard operation
marimo copied to clipboard

New dataframe transform: Polars Native Expand Dict Transformation

Open adarshchbs opened this issue 7 months ago • 1 comments

Description

I'm proposing to extend Expand Dict dataframe transformation that implements Polars' column unnest functionality. Currently, marimo has an Expand Dict feature, but it fails when a column contains null values, throwing the error: 'NoneType' object cannot be converted to 'PyDict'.

Suggested solution

The native Polars method df.unnest("column_name") handles null values gracefully without failing. This new transformation would leverage the Polars unnest method directly, making it more robust when working with dictionaries that contain null values.

It would allow users to flatten nested dictionaries into separate columns without having to pre-process the data to handle null values.

I am willing to submit a PR to implement this functionality if desired.

Alternative

No response

Additional context

Error message: Image

adarshchbs avatar Apr 18 '25 08:04 adarshchbs

@adarshchbs - this would be a great addition if you are open to submitting the PR. We are here to help (best to communicate via Discord)

mscolnick avatar Apr 21 '25 16:04 mscolnick