Serialize to JSON representation
Description
Serialize to JSON representation
Usage
<DataFrame>$write_json(file)
Arguments
file
|
File path to which the result will be written. |
Value
The input DataFrame is returned.
Examples
library("polars")
dat <- as_polars_df(head(mtcars))
destination <- tempfile()
dat$select(pl$col("drat", "mpg"))$write_json(destination)
#> shape: (6, 2)
#> ┌──────┬──────┐
#> │ drat ┆ mpg │
#> │ --- ┆ --- │
#> │ f64 ┆ f64 │
#> ╞══════╪══════╡
#> │ 3.9 ┆ 21.0 │
#> │ 3.9 ┆ 21.0 │
#> │ 3.85 ┆ 22.8 │
#> │ 3.08 ┆ 21.4 │
#> │ 3.15 ┆ 18.7 │
#> │ 2.76 ┆ 18.1 │
#> └──────┴──────┘
#> drat mpg
#> 1 3.90 21.0
#> 2 3.90 21.0
#> 3 3.85 22.8
#> 4 3.08 21.4
#> 5 3.15 18.7
#> 6 2.76 18.1