Permalink
Fetching contributors…
Cannot retrieve contributors at this time
145 lines (108 sloc) 2.44 KB
CurrentModule = IndexedTables
DocTestSetup = quote
    using JuliaDB
end

Selection

Select, transform and filter a table.

Select

select

Map

map(f, t::NextTable; kwargs...)
map(f, t::NDSparse; kwargs...)

Filter

filter
dropna

AoS and SoA

This section describes extracting struct of arrays (columns) and array of structs (rows) from a table or an NDSparse. (Wikipedia entry on AoS and SoA)

columns
rows
keys
values

Column modification

This section describes functions that can modify the set of columns of a table. Note that these functions return new tables and doesn't mutate the existing table. This is done so that type information for a given table is always available and correct.

setcol
pushcol
popcol
insertcol
insertcolafter
insertcolbefore
renamecol

Column special selection

This section describes some special types that can be used to simplify column selection. These types can be used in combination with select, rows or columns, as well as any other function that requires a by or select argument.

All
Not
Keys
Between

To select columns whose name respects a given predicate, pass a function to select (or rows, or columns):

julia> t = table([0.01, 0.05], [2, 1], [2, 3], names=[:t, :x, :z])
Table with 2 rows, 3 columns:
t     x  z
──────────
0.01  2  2
0.05  1  3

julia> select(t, i -> i != :z)
Table with 2 rows, 2 columns:
t     x
───────
0.01  2
0.05  1

To filter columns whose name matches a regular expression, pass the Regex directly:

julia> t = table([0.01, 0.05], [2.3, 1.2], ["setosa", "virginica"],
    names=[:PetalLength, :PetalWidth, :Species])
Table with 2 rows, 3 columns:
PetalLength  PetalWidth  Species
────────────────────────────────────
0.01         2.3         "setosa"
0.05         1.2         "virginica"

julia> select(t, r"^Petal")
Table with 2 rows, 2 columns:
PetalLength  PetalWidth
───────────────────────
0.01         2.3
0.05         1.2