Skip to content

Commit db544f4

Browse files
authored
Update tutorial.md (#68)
* Update tutorial.md add tutorial about exporting data * Update tutorial.md some modifications about exporting tutorial * Update tutorial.md
1 parent a2b9436 commit db544f4

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

docs/src/man/tutorial.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,3 +476,82 @@ julia> @chain flights begin
476476
```
477477

478478
![cancellation](https://raw.githubusercontent.com/sl-solution/InMemoryDatasetsTutorial/main/flights.svg)
479+
480+
## Exporting your data
481+
482+
You can use the `JLD2.jl` package to export the data set with meta information into a JLD2 file.
483+
484+
```julia
485+
julia> using JLD2
486+
julia> content(flights)
487+
467402×17 Dataset
488+
Created: 2022-08-09T16:04:51.122
489+
Modified: 2022-08-09T16:05:03.822
490+
Info: Reporting Carrier On-Time Performance for all flights in 2020 from CA. Downloaded from www.transtats.bts.gov
491+
-----------------------------------
492+
Columns information
493+
┌─────┬──────────────────┬──────────┬─────────┐
494+
│ Row │ col │ format │ eltype │
495+
├─────┼──────────────────┼──────────┼─────────┤
496+
1 │ FlightDate │ month │ Date │
497+
2 │ IATA │ identity │ String │
498+
3 │ Tail_Number │ identity │ String │
499+
4 │ Flight_Number │ identity │ Int64 │
500+
5 │ Origin │ identity │ String │
501+
6 │ Dest │ identity │ String │
502+
7 │ TaxiOut │ identity │ Float64 │
503+
8 │ TaxiIn │ identity │ Float64 │
504+
9 │ DepDelay │ identity │ Float64 │
505+
10 │ ArrDelay │ identity │ Float64 │
506+
11 │ DepTime │ identity │ Int64 │
507+
12 │ ArrTime │ identity │ Int64 │
508+
13 │ AirTime │ identity │ Float64 │
509+
14 │ Cancelled │ identity │ Float64 │
510+
15 │ CancellationCode │ identity │ String │
511+
16 │ Distance │ identity │ Float64 │
512+
17 │ Speed │ identity │ Float64 │
513+
└─────┴──────────────────┴──────────┴─────────┘
514+
515+
julia> @save "flights.jld2" flights
516+
julia> @load "flights.jld2" flights
517+
1-element Vector{Symbol}:
518+
:flights
519+
520+
julia> content(flights)
521+
467402×17 Dataset
522+
Created: 2022-08-09T16:04:51.122
523+
Modified: 2022-08-09T16:05:03.822
524+
Info: Reporting Carrier On-Time Performance for all flights in 2020 from CA. Downloaded from www.transtats.bts.gov
525+
-----------------------------------
526+
Columns information
527+
┌─────┬──────────────────┬──────────┬─────────┐
528+
│ Row │ col │ format │ eltype │
529+
├─────┼──────────────────┼──────────┼─────────┤
530+
1 │ FlightDate │ month │ Date │
531+
2 │ IATA │ identity │ String │
532+
3 │ Tail_Number │ identity │ String │
533+
4 │ Flight_Number │ identity │ Int64 │
534+
5 │ Origin │ identity │ String │
535+
6 │ Dest │ identity │ String │
536+
7 │ TaxiOut │ identity │ Float64 │
537+
8 │ TaxiIn │ identity │ Float64 │
538+
9 │ DepDelay │ identity │ Float64 │
539+
10 │ ArrDelay │ identity │ Float64 │
540+
11 │ DepTime │ identity │ Int64 │
541+
12 │ ArrTime │ identity │ Int64 │
542+
13 │ AirTime │ identity │ Float64 │
543+
14 │ Cancelled │ identity │ Float64 │
544+
15 │ CancellationCode │ identity │ String │
545+
16 │ Distance │ identity │ Float64 │
546+
17 │ Speed │ identity │ Float64 │
547+
└─────┴──────────────────┴──────────┴─────────┘
548+
```
549+
550+
Also, you can use `DLMReader` package to write an `AbstractDataset` as text to a file using a given delimiter (which defaults to comma).
551+
552+
```julia
553+
julia> using DLMReader
554+
julia> filewriter("flights.csv", flights)
555+
```
556+
557+
To write the formatted values, you need to use `filwriter` with `mapformats = true` option. For more information, see `?filewriter`.

0 commit comments

Comments
 (0)