queryverse / FstFiles.jl

FileIO.jl integration for fst files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FstFiles

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Build Status Build status FstFiles codecov.io

Overview

This package provides load support for fst files under the FileIO.jl package.

Installation

Use Pkg.add("FstFiles") in Julia to install FstFiles and its dependencies.

Usage

Load a fst file

To read a fst file into a DataFrame, use the following julia code:

using FileIO, FstFiles, DataFrames

df = DataFrame(load("data.fst"))

The call to load returns a struct that is an IterableTable.jl, so it can be passed to any function that can handle iterable tables, i.e. all the sinks in IterableTable.jl. Here are some examples of materializing a fst file into data structures that are not a DataFrame:

using FileIO, FstFiles, DataTables, IndexedTables, TimeSeries, Temporal, Gadfly

# Load into a DataTable
dt = DataTable(load("data.fst"))

# Load into an IndexedTable
it = IndexedTable(load("data.fst"))

# Load into a TimeArray
ta = TimeArray(load("data.fst"))

# Load into a TS
ts = TS(load("data.fst"))

# Plot directly with Gadfly
plot(load("data.fst"), x=:a, y=:b, Geom.line)

Save a fst file

The following code saves any iterable table as a fst file:

using FileIO, FstFiles

save("output.fst", it)

This will work as long as it is any of the types supported as sources in IterableTables.jl.

Using the pipe syntax

Both load and save also support the pipe syntax. For example, to load a fst file into a DataFrame, one can use the following code:

using FileIO, FstFiles, DataFrame

df = load("data.fst") |> DataFrame

To save an iterable table, one can use the following form:

using FileIO, FstFiles, DataFrame

df = # Aquire a DataFrame somehow

df |> save("output.fst")

The pipe syntax is especially useful when combining it with Query.jl queries, for example one can easily load a fst file, pipe it into a query, then pipe it to the save function to store the results in a new file.

About

FileIO.jl integration for fst files

License:Other


Languages

Language:Julia 100.0%