Skip to content

Latest commit

 

History

301 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IterableTables

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

Overview

Iterable tables is a generic interface for tabular data, defined in TableTraits.jl.

This package historically hosted the interface implementations for many third-party table types. That role is over: packages like DataFrames, TimeSeries and StatsModels have long implemented the iterable tables interface natively (typically via Tables.jl), so they interoperate with the Queryverse without any help from this package.

What this package still provides:

  • Any iterator of NamedTuples — for example a generator expression such as ((a=i, b=i^2) for i in 1:10) — becomes an iterable table, so it can be queried with Query.jl or passed to any iterable table sink.
  • An integration for Temporal, which has no native support for the interface: a TS value works as a source, and TS(iterable_table; index_column=:Index) works as a sink.

Installation

julia> ]add IterableTables

Getting started

A generator of named tuples can be piped into a query or into any sink, for example a DataFrame or a CSV file:

using IterableTables, Query, DataFrames, CSVFiles, FileIO

g = ((a=i, b=i^2) for i in 1:10)

df = g |> @filter(_.a > 5) |> DataFrame

save("data.csv", g)

A Temporal.TS works as a source and sink around a query:

using IterableTables, Query, Temporal

ts2 = ts |> @filter(_.price > 100.) |> x -> TS(x, index_column=:Index)

For sinks that only accept concrete table types (for example Gadfly.plot or the TimeArray constructor from TimeSeries), convert the query result to a DataFrame first:

using Gadfly

df |> @filter(_.a > 5) |> DataFrame |> d -> plot(d, x=:a, y=:b, Geom.point)

Historical note

Earlier versions of this package shipped @require-based integrations for DataFrames, TimeSeries, StatsModels, Gadfly and JuliaDB. These were removed: the first three gained native support for the interface years ago (the integrations here had already been dead code since 2019), and the Gadfly and JuliaDB integrations had been disabled since 2018. New integrations should be implemented in the package that defines the table type, using TableTraits.jl — see the documentation for an integration guide.

About

Implementations of the TableTraits.jl interface for various packages

Topics

Resources

Contributing

Stars

79 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages