Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for JLD2 I/O #3365

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/src/man/importing_and_exporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,28 @@ As you can see the code required to transform `iris` into a proper input to the
format is not easy. Therefore CSV.jl is the preferred package to write CSV files
for data stored in data frames.

## JLD2 Files

A convenient format for reading and writing data frames in JLD2, which saves and loads
Julia data structures in a format comprising a subset of HDF5. Unlike several other
formats, JLD2 preserves custom Types. The `save` and `load` functions, provided by FileIO.jl,
allow to read/write a data frame from/to a JLD2 file.
alex-s-gardner marked this conversation as resolved.
Show resolved Hide resolved

A data frame can be saved as a JLD2 file output.jld2 using

Comment on lines +123 to +124
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A data frame can be saved as a JLD2 file output.jld2 using

```julia
using FileIO
alex-s-gardner marked this conversation as resolved.
Show resolved Hide resolved
using Pkg; Pkg.add("JLD2")

df = DataFrame(x=1, y=2)
save("output.jld2", Dict("df" => df))
```

and can be read using
```julia
load("output.jld2") # -> Dict{String, Any} with 1 entry: "df" => 1×2 DataFrame
alex-s-gardner marked this conversation as resolved.
Show resolved Hide resolved
```

## Other formats

Other data formats are supported for reading and writing in the following packages
Expand Down