Add documentation for JLD2 I/O#3365
Conversation
|
I have left some stylistic comments. Additionally, since I am not using JLD2 format myself. The question is how does it handle saving |
I tested saving and loading both maybe here: .... , JLD2 preserves custom Types including |
|
Sorry for a delay. I think it is OK the way you proposed. Just can you please move JLD2 after CSV (as CSV is for sure more popular). Also @nalimilan - could you please have a look at wording of the PR? |
|
|
||
| If you have not used the FileIO and JLD2 packages before then you may need to install it first: | ||
| ```julia | ||
| using Pkg; |
There was a problem hiding this comment.
| using Pkg; | |
| using Pkg |
| A data frame can be saved as a JLD2 file output.jld2 using | ||
|
|
There was a problem hiding this comment.
| A data frame can be saved as a JLD2 file output.jld2 using |
| using JLD2 | ||
| ``` | ||
|
|
||
| We can now create a simple data frame and save it as a jld2 file using `save`. `save` |
There was a problem hiding this comment.
| We can now create a simple data frame and save it as a jld2 file using `save`. `save` | |
| We can now create a simple data frame and save it as a JLD2 file using `save`. `save` |
| ``` | ||
|
|
||
| We can now create a simple data frame and save it as a jld2 file using `save`. `save` | ||
| accepts an AbstractDict yielding the key/value pairs, where the key is a string representing |
There was a problem hiding this comment.
| accepts an AbstractDict yielding the key/value pairs, where the key is a string representing | |
| accepts an `AbstractDict` yielding the key/value pairs, where the key is a string representing |
| Pkg.add("FileIO") | ||
| Pkg.add("JLD2") |
There was a problem hiding this comment.
This will typically be faster:
| Pkg.add("FileIO") | |
| Pkg.add("JLD2") | |
| Pkg.add(["FileIO", "JLD2"]) |
| A jld2 file can be read in using `load`. If `load` is called with a single dataset name, | ||
| load returns the contents of that dataset from the file: | ||
| ```julia | ||
| df = load("output.jld2", "df") |
There was a problem hiding this comment.
| df = load("output.jld2", "df") | |
| julia> df = load("output.jld2", "df") |
| df = load("output.jld2") | ||
| Dict{String, Any} with 1 entry: | ||
| "df" => 1×2 DataFrame… |
There was a problem hiding this comment.
| df = load("output.jld2") | |
| Dict{String, Any} with 1 entry: | |
| "df" => 1×2 DataFrame… | |
| julia> dict = load("output.jld2") | |
| Dict{String, Any} with 1 entry: | |
| "df" => 1×2 DataFrame… | |
| julia> df = dict.df | |
| 1×2 DataFrame | |
| Row │ x y | |
| │ Int64 Int64 | |
| ─────┼────────────── | |
| 1 │ 1 2 |
| JLD2 is a HDF5-compatible file format that allows reading and writing data frames. | ||
| A valuable feature of JLD2 format is that it preserves custom column types of the stored data frame. | ||
|
|
||
| The `save` and `load` functions, provided by FileIO.jl, allow to read/write a data frame from/to a JLD2 file. |
There was a problem hiding this comment.
| The `save` and `load` functions, provided by FileIO.jl, allow to read/write a data frame from/to a JLD2 file. | |
| The `save` and `load` functions, provided by [FileIO.jl](https://github.com/JuliaIO/FileIO.jl/), | |
| provides convenience functions to read/write objects from/to a JLD2 file. |
| ## JLD2 Files | ||
|
|
||
| JLD2 is a HDF5-compatible file format that allows reading and writing data frames. | ||
| A valuable feature of JLD2 format is that it preserves custom column types of the stored data frame. |
There was a problem hiding this comment.
| A valuable feature of JLD2 format is that it preserves custom column types of the stored data frame. | |
| A valuable feature of the JLD2 format is that it preserves custom column types of the stored data frame. |
|
|
||
| ## JLD2 Files | ||
|
|
||
| JLD2 is a HDF5-compatible file format that allows reading and writing data frames. |
There was a problem hiding this comment.
| JLD2 is a HDF5-compatible file format that allows reading and writing data frames. | |
| [JLD2](https://github.com/JuliaIO/JLD2.jl) is a HDF5-compatible file format that allows | |
| reading and writing data frames (and any Julia object). |
Addresses #3364