Skip to content

A simple read-only table type for the Queryverse

License

Notifications You must be signed in to change notification settings

queryverse/DataTables.jl

Repository files navigation

DataTables.jl

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Build Status codecov

Overview

A simple read-only table type for the Queryverse.

Installation

You can install the package at the Pkg REPL-mode with:

pkg> add DataTables

Getting started

The main type in this package is DataTable, a data structure for tabular data. To create a new DataTable with a number of columns, just pass the columns as keyword arguments to the DataTable constructor:

julia> dt = DataTable(Name=["John", "Sally", "Jim"], Age=[23., 43., 56.], Children=[2, 0, 3])
3x3 DataTable
Name  │ Age  │ Children
──────┼──────┼─────────
John  │ 23.02
Sally │ 43.00
Jim   │ 56.03

To access an individual column by name, use the . dot syntax:

julia> dt.Age
3-element ReadOnlyArrays.ReadOnlyArray{Float64,1,Array{Float64,1}}:
 23.0
 43.0
 56.0

To access an individual row, use the normal julia index syntax:

julia> dt[2]
(Name = "Sally", Age = 43.0, Children = 0)

If you want to access the value in an individual cell, it is generally more efficient to first access the column via the dot syntax, and then select the value for a given row via indexing:

julia> dt.Name[2]
"Sally"

You can also create a new DataTable by passing any object to its constructor that implements the TableTraits.jl interface. That includes everything in the Queryverse, but also many other table types like DataFrames.jl, IndexedTables.jl etc. Every DataTable also implements the TableTraits.jl interface and can therefore be passed to any function that accepts a TableTraits.jl value.

Alternatives

DataTables.jl is not the only julia initiative for tabular data, there are many other packages that have similar goals. Take a look at DataFrames.jl, IndexedTables.jl and TypedTables.jl (which in particular was a major inspiration for this package here). If I missed other packages, please let me know and I'll add them to this list!

Getting help

Please ask any usage question in the Data Domain on the julia Discourse forum. If you find a bug or have an improvement suggestion for this package, please open an issue in this github repository.

About

A simple read-only table type for the Queryverse

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages