# How to easily save Julia data?

**URL:** <https://discourse.julialang.org/t/how-to-easily-save-julia-data/125955>\
**Category:** General Usage\
**Tags:** question, serialization\
**Created:** [February 16, 2025, 10:16am UTC](https://discourse.julialang.org/t/how-to-easily-save-julia-data/125955 "2025-02-16T10:16:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xu\_Shan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xu_shan/32/214900_2.png) [@Xu\_Shan](https://discourse.julialang.org/u/Xu_Shan)\
**Post date:** [February 16, 2025, 10:16am UTC](https://discourse.julialang.org/t/how-to-easily-save-julia-data/125955/1 "2025-02-16T10:16:47Z")

</div>

Hi guys,  
I am wondering is there a way like `pickle` in python to save the output data from Julia calculations? maybe it can support arrays, dict, tuples? for example, if I have a dict of which each key stores a different dataframe (columns rows are different), then how can I save it? and then how to load it? (if the method is compatible with python, then it would be much more better!)

Here is my example

```julia
julia> sensitivity_results
Dict{Any, Any} with 230 entries:
  "pWaterRootHalfLoss_transpiration" => 1×4 DataFrame…
  "κ_total_plant_water_content" => 1×4 DataFrame…
  ....
julia> sensitivity_results["pWaterRootHalfLoss_transpiration"]
1×4 DataFrame
 Row │ sensitivity_mean sensitivity_std sensitivity_daily sensitivity_seasonal 
     │ Float64 Float64 Float64 Float64              
─────┼────────────────────────────────────────────────────────────────────────────
   1 │ 0.000450049 0.000635199 0.000538933 0.000614739
julia> sensitivity_results["κ_total_plant_water_content"]
1×4 DataFrame
 Row │ sensitivity_mean sensitivity_std sensitivity_daily sensitivity_seasonal 
     │ Float64 Float64 Float64 Float64              
─────┼────────────────────────────────────────────────────────────────────────────
   1 │ -0.131991 -0.148735 -0.146674 -0.148216

```

Thanks!

---

<div class="post-metadata">

**Author:** ![DanielePessina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielepessina/32/215157_2.png) [@DanielePessina](https://discourse.julialang.org/u/DanielePessina)\
**Post date:** [February 16, 2025, 11:26am UTC](https://discourse.julialang.org/t/how-to-easily-save-julia-data/125955/2 "2025-02-16T11:26:49Z")

</div>

In my experience [JLD2.jl](https://github.com/JuliaIO/JLD2.jl) is equivalent to the `pickle` module in python. To get python compatible objects you can save tabular data with [Arrow.jl](https://arrow.apache.org/julia/stable/) or simply write a CSV.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 16, 2025, 6:34pm UTC](https://discourse.julialang.org/t/how-to-easily-save-julia-data/125955/3 "2025-02-16T18:34:53Z")

</div>

While I would also suggest JLD2.jl to save Julia data, the equivalent to the pickle module of Python is [Serialization · The Julia Language](https://docs.julialang.org/en/v1/stdlib/Serialization/) , which is part of Julia and does not require an extra package. You still need to write `using Serialization` at the top of your file, though.

---

<div class="post-metadata">

**Author:** ![ohmsweetohm1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ohmsweetohm1/32/49126_2.png) [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Post date:** [February 16, 2025, 7:54pm UTC](https://discourse.julialang.org/t/how-to-easily-save-julia-data/125955/4 "2025-02-16T19:54:39Z")

</div>

BSON.jl and JLSO.jl also work quite well. You can save complete structs and just need to import the corresponding module when you want to deserialize it.

---

<div class="post-metadata">

**Author:** ![linwaytin](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Post date:** [February 16, 2025, 8:22pm UTC](https://discourse.julialang.org/t/how-to-easily-save-julia-data/125955/5 "2025-02-16T20:22:51Z")

</div>

Serialization is the most convenient one.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 16, 2025, 8:32pm UTC](https://discourse.julialang.org/t/how-to-easily-save-julia-data/125955/6 "2025-02-16T20:32:24Z")

</div>

Well, all solutions have advantages and disadvantages. Look at:

- backwards compatibility (can a new version read data written by an old version)
- do you just want to save just numbers and strings, or more complex - perhaps even Julia specific - data structures
- performance (read, write and package load time)
- file size
- shall the data format be standardized, shall it be possible to read and write it in other programming languages or on computers with a different CPU architecture

If you know all of that, then you can choose the best solution for your use case.
