nushell/crates/nu_plugin_polars/src/dataframe
Jack Wright ff8831318d
Added polars struct-encode-json, providing the ability to encode structs as json (#15678)
# Description
This PR introduces `polars struct-encode-json`. This exposes the ability
to encode struct columns as json strings. This is useful when converting
things to formats like CSV that do not support complex types.

```nushell
> ❯ : [[id person]; [1 {name: "Bob", age: 36}] [2 {name: "Betty", age: 63}]]
                    | polars into-df -s {id: i64, person: {name: str, age: u8}}
                    | polars select id (polars col person | polars struct-json-encode | polars as encoded) 
                    | polars collect
╭───┬────┬───────────────────────────╮
│ # │ id │          encoded          │
├───┼────┼───────────────────────────┤
│ 0 │  1 │ {"age":36,"name":"Bob"}   │
│ 1 │  2 │ {"age":63,"name":"Betty"} │
╰───┴────┴───────────────────────────╯
```

# User-Facing Changes
* Added `polars struct-encode-json`, providing the ability to encode
structs as json
2025-05-06 13:58:51 -07:00
..
command Added polars struct-encode-json, providing the ability to encode structs as json (#15678) 2025-05-06 13:58:51 -07:00
values feat(polars): enable parsing strings as dates and datetime in polars schema (#15645) 2025-04-26 11:47:58 -07:00
mod.rs Polars command reorg (#13798) 2024-09-06 13:46:37 -07:00
README.md Move dataframes support to a plugin (#12220) 2024-04-09 19:31:43 -05:00
utils.rs Upgrade to polars 0.43 (#14148) 2024-10-23 19:14:24 +02:00

Dataframe

This dataframe directory holds all of the definitions of the dataframe data structures and commands.

There are three sections of commands:

For more details see the Nushell book section on dataframes