nushell/crates/nu_plugin_polars/src
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
..
cache Introduction of NuDataType and polars dtype (#15529) 2025-04-09 08:13:49 -07:00
cloud Polars AWS S3 support (#14648) 2024-12-25 06:15:50 -06:00
dataframe Added polars struct-encode-json, providing the ability to encode structs as json (#15678) 2025-05-06 13:58:51 -07:00
lib.rs Introduction of NuDataType and polars dtype (#15529) 2025-04-09 08:13:49 -07:00
main.rs remove mimalloc allocator (#15317) 2025-03-15 09:32:55 -05:00