polars icon indicating copy to clipboard operation
polars copied to clipboard

Make `unnest()` "unnest" all columns by default

Open Julian-J-S opened this issue 4 months ago • 1 comments

Description

Most of the times in my experience you want to "unnest" ALL of the structs you have or only have 1-2 that you want to unnest. It is annoying to have to specify those explicitly in the unnest call. Sometimes you change your data or column names but still want to unnest and need to remember to change names everywhere.

Imo unnest() means "unnest" (all) my data so when providing no argument it should default to unnesting everything

pl.DataFrame(
    {
        "s1": [
            {"a": 1, "b": 2},
            {"a": 3, "b": 4},
        ],
        "s2": [
            {"c": 5, "d": 6},
            {"c": 7, "d": 8},
        ],
    }
).unnest("s1", "s2")
  • currently I have to use .unnest("s1", "s2")
  • desired unnest(): meaning "unnest all column"

Julian-J-S avatar Sep 26 '24 08:09 Julian-J-S