DataAPI.All
— TypeAll()
Select all columns.
DataAPI.Between
— TypeBetween(first, last)
Select the columns between first
and last
(including both) from a table.
DataAPI.BroadcastedSelector
— TypeBroadcastedSelector(selector)
Wrapper type around a Between
, All
or Cols
indicating that an operation should be applied to each column included by the wrapped selector.
Examples
julia> using DataAPI
julia> DataAPI.Between(:a, :e) .=> sin
DataAPI.BroadcastedSelector{DataAPI.Between{Symbol, Symbol}}(DataAPI.Between{Symbol, Symbol}(:a, :e)) => sin
julia> DataAPI.Cols(r"x") .=> [sum, prod]
2-element Vector{Pair{DataAPI.BroadcastedSelector{DataAPI.Cols{Tuple{Regex}}}, _A} where _A}:
DataAPI.BroadcastedSelector{DataAPI.Cols{Tuple{Regex}}}(DataAPI.Cols{Tuple{Regex}}((r"x",))) => sum
DataAPI.BroadcastedSelector{DataAPI.Cols{Tuple{Regex}}}(DataAPI.Cols{Tuple{Regex}}((r"x",))) => prod
DataAPI.Cols
— TypeCols(cols...; operator=union)
Cols(f::Function; operator=union)
Select columns matching specifications in cols
. If cols == ()
, select no columns.
If the only positional argument is a Function
f
then select the columns whose names passed to the f
predicate as strings return true
.
When multiple cols
selectors are passed then the sets of columns selected by them are passed to operator
as positional arguments. operator
should be a set operation function, like union
, intersect
, setdiff
, and symdiff
defined in Base Julia. By default operator=union
in which case all columns matching at least one selector are returned.
DataAPI.allcombinations
— Functionallcombinations(sink, ...)
Create table from all combinations of values in passed arguments using a sink
function to materialize the table.
DataAPI.colmetadata
— Functioncolmetadata(x, col, key::AbstractString, [default]; style::Bool=false)
Return metadata value associated with table x
for column col
and key key
. Throw an error if x
does not support reading metadata for column col
or x
supports reading metadata, but does not have a mapping for column col
for key
.
col
must have a type that is supported by table x
for column indexing. Following the Tables.jl contract Symbol
and Int
are always allowed. Throw an error if col
is not a column of x
.
If style=true
return a tuple of metadata value and metadata style. Metadata style is an additional information about the kind of metadata that is stored for the key
.
One of the uses of the metadata style
is decision how the metadata should be propagated when x
is transformed. This interface defines the :default
style that indicates that metadata should not be propagated under any operations (it is only preserved when a copy of the source table is performed). All types supporting metadata allow at least this style.
If default
is passed then return it if x
supports reading metadata and has column col
but mapping for key
is missing. If style=true
return (default, :default)
.
DataAPI.colmetadata!
— Functioncolmetadata!(x, col, key::AbstractString, value; style::Symbol=:default)
Set metadata for table x
for column col
for key key
to have value value
and style style
(:default
by default) and return x
. Throw an error if x
does not support setting metadata for column col
.
col
must have a type that is supported by table x
for column indexing. Following the Tables.jl contract Symbol
and Int
are always allowed. Throw an error if col
is not a column of x
.
One of the uses of the metadata style
is decision how the metadata should be propagated when x
is transformed. This interface defines the :default
style that indicates that metadata should not be propagated under any operations (it is only preserved when a copy of the source table is performed). All types supporting metadata allow at least this style.
DataAPI.colmetadata
— Methodcolmetadata(x, [col]; style::Bool=false)
If col
is not passed return a dictionary mapping columns represented as Symbol
that have associated metadata to dictionaries mapping all metadata keys to metadata values associated with table x
for a given column.
If col
is passed return a dictionary mapping all column metadata keys to metadata values associated with column col
of table x
. Throw an error if x
does not support reading metadata for column col
or column col
is not present in x
.
If style=true
values are tuples of metadata value and metadata style. Metadata style is an additional information about the kind of metadata that is stored for the key
.
One of the uses of the metadata style
is decision how the metadata should be propagated when x
is transformed. This interface defines the :default
style that indicates that metadata should not be propagated under any operations (it is only preserved when a copy of the source table is performed). All types supporting metadata allow at least this style.
The returned dictionary may be freshly allocated on each call to colmetadata
and is considered to be owned by x
so it must not be modified.
DataAPI.colmetadatakeys
— Functioncolmetadatakeys(x, [col])
If col
is passed return an iterator of metadata keys for which metadata(x, col, key)
returns a metadata value. Throw an error if x
does not support reading column metadata or if col
is not a column of x
.
col
must have a type that is supported by table x
for column indexing. Following the Tables.jl contract Symbol
and Int
are always allowed.
If col
is not passed return an iterator of col => colmetadatakeys(x, col)
pairs for all columns that have metadata, where col
are Symbol
. If x
does not support column metadata return ()
.
DataAPI.colmetadatasupport
— Methodcolmetadatasupport(T::Type)
Return a NamedTuple{(:read, :write), Tuple{Bool, Bool}}
indicating whether values of type T
support column metadata.
The read
field indicates whether reading metadata with the colmetadata
and colmetadatakeys
functions is supported.
The write
field indicates whether modifying metadata with the colmetadata!
, deletecolmetadata!
, and emptycolmetadata!
functions is supported.
DataAPI.defaultarray
— Functiondefaultarray(T, N)
For a given element type T
and number of dimensions N
, return the appropriate array type.
The default definition returns Array{T, N}
. This function is useful for custom types that have a more efficient vectorized representation (usually using SOA optimizations).
This generic function is owned by DataAPI.jl itself, which is the sole provider of the default definition.
DataAPI.deletecolmetadata!
— Functiondeletecolmetadata!(x, col, key::AbstractString)
Delete metadata for table x
for column col
for key key
and return x
(if metadata for key
is not present do not perform any action). Throw an error if x
does not support metadata deletion for column col
.
DataAPI.deletemetadata!
— Functiondeletemetadata!(x, key::AbstractString)
Delete metadata for object x
for key key
and return x
(if metadata for key
is not present do not perform any action). Throw an error if x
does not support metadata deletion.
DataAPI.describe
— Functiondescribe(io::IO, x)
For an object x
, print descriptive statistics to io
.
This generic function is owned by StatsBase.jl, which is the sole provider of the default definition.
DataAPI.emptycolmetadata!
— Functionemptycolmetadata!(x, [col])
Delete all metadata for table x
for column col
. If col
is not passed delete all column level metadata for table x
. Throw an error if x
does not support metadata deletion for column col
.
DataAPI.emptymetadata!
— Functionemptymetadata!(x)
Delete all metadata for object x
. Throw an error if x
does not support metadata deletion.
DataAPI.invrefpool
— Functioninvrefpool(A)
Whenever available, return an indexable object such that given an array A
for which refpool(A)
is not nothing
:
- for any valid index
x
intorefpool(A)
,invrefpool(A)[refpool(A)[x]]
is equal tox
(according toisequal
) and of the same type asx
; - for any valid index
ix
intoinvrefpool(A)
,refpool(A)[invrefpool(A)[ix]]
is equal toix
(according toisequal
) and of the same type asix
.
Additionally it is required that for invrefpool(A)
the following methods are defined:
Base.haskey
: allowing to check ifix
is a valid index into it.Base.get
: allowing to get a value from it or a passed default value if it is not present.
By default, invrefpool(A)
returns nothing
.
If invrefpool(A)
is not nothing
, then refpool(A)
also must not be nothing
.
This generic function is owned by DataAPI.jl itself, which is the sole provider of the default definition.
DataAPI.levels
— Methodlevels(x; skipmissing=true)
Return a vector of unique values which occur or could occur in collection x
. missing
values are skipped unless skipmissing=false
is passed.
Values are returned in the preferred order for the collection, with the result of sort
as a default. If the collection is not sortable then the order of levels is unspecified.
Contrary to unique
, this function may return values which do not actually occur in the data, and does not preserve their order of appearance in x
.
DataAPI.metadata
— Functionmetadata(x, key::AbstractString, [default]; style::Bool=false)
Return metadata value associated with object x
for key key
. Throw an error if x
does not support reading metadata or does not have a mapping for key
.
If style=true
return a tuple of metadata value and metadata style. Metadata style is an additional information about the kind of metadata that is stored for the key
.
One of the uses of the metadata style
is decision how the metadata should be propagated when x
is transformed. This interface defines the :default
style that indicates that metadata should not be propagated under any operations (it is only preserved when a copy of the source table is performed). All types supporting metadata allow at least this style.
If default
is passed then return it if reading metadata is supported but mapping for key
is missing. If style=true
return (default, :default)
.
DataAPI.metadata!
— Functionmetadata!(x, key::AbstractString, value; style::Symbol=:default)
Set metadata for object x
for key key
to have value value
and style style
(:default
by default) and return x
. Throw an error if x
does not support setting metadata.
One of the uses of the metadata style
is decision how the metadata should be propagated when x
is transformed. This interface defines the :default
style that indicates that metadata should not be propagated under any operations (it is only preserved when a copy of the source table is performed). All types supporting metadata allow at least this style.
DataAPI.metadata
— Methodmetadata(x; style::Bool=false)
Return a dictionary mapping all metadata keys to metadata values associated with object x
. Throw an error if x
does not support reading metadata.
If style=true
values are tuples of metadata value and metadata style. Metadata style is an additional information about the kind of metadata that is stored for the key
.
One of the uses of the metadata style
is decision how the metadata should be propagated when x
is transformed. This interface defines the :default
style that indicates that metadata should not be propagated under any operations (it is only preserved when a copy of the source table is performed). All types supporting metadata allow at least this style.
The returned dictionary may be freshly allocated on each call to metadata
and is considered to be owned by x
so it must not be modified.
DataAPI.metadatakeys
— Functionmetadatakeys(x)
Return an iterator of metadata keys for which metadata(x, key)
returns a metadata value. Throw an error if x
does not support reading metadata.
DataAPI.metadatasupport
— Methodmetadatasupport(T::Type)
Return a NamedTuple{(:read, :write), Tuple{Bool, Bool}}
indicating whether values of type T
support metadata.
The read
field indicates whether reading metadata with the metadata
and [metadatakeys
]](@ref) functions is supported.
The write
field indicates whether modifying metadata with the metadata!
, deletemetadata!
, and emptymetadata!
functions is supported.
DataAPI.ncol
— Functionncol(t)
Return the number of columns of table t
.
DataAPI.nrow
— Functionnrow(t)
Return the number of rows of table t
.
DataAPI.refarray
— Functionrefarray(A::AbstractArray)
For a given array A
, potentially return an optimized "ref array" representation of the original array, which can allow for faster comparison and sorting.
The default definition just returns the input array. This function is useful for custom array types which already store a "hashed"-like representation of elements where testing equality or permuting elements in place can be much faster than the original scalar value, like pooled arrays.
This generic function is owned by DataAPI.jl itself, which is the sole provider of the default definition.
DataAPI.refpool
— Functionrefpool(A)
Whenever available, return an indexable object pool
such that, given the original array A
and a "ref value" x
taken from refarray(A)
, pool[x]
is the appropriate original value. Return nothing
if such object is not available.
By default, refpool(A)
returns nothing
.
If refpool(A)
is not nothing
, then refpool(A)[refarray(A)[I...]]
must be equal to (according to isequal
) and of the same type as A[I...]
, and the object returned by refpool(A)
must implement the iteration and indexing interfaces as well as the length
, eachindex
, keys
, values
, pairs
, firstindex
, lastindex
, and eltype
functions in accordance with the AbstractArray
interface.
This generic function is owned by DataAPI.jl itself, which is the sole provider of the default definition.
DataAPI.refvalue
— Functionrefvalue(A, x)
For the original array A
, and a "ref value" x
taken from refarray(A)
, return the appropriate original value. refvalue(A, refarray(A)[I...])
must be equal to A[I...]
.
By default, refvalue(A, x)
returns x
(since refarray(A)
returns A
by default). This allows recovering an original array element after operating on the "ref values".
This generic function is owned by DataAPI.jl itself, which is the sole provider of the default definition.
DataAPI.rownumber
— Functionrownumber(row)
Return the row number of row
in the source table.
DataAPI.unwrap
— Functionunwrap(x)
For a given scalar argument x
, potentially "unwrap" it to return the base wrapped value. Useful as a generic API for wrapper types when the original value is needed.
The default definition just returns x
itself, i.e. no unwrapping is performned.
This generic function is owned by DataAPI.jl itself, which is the sole provider of the default definition.