Deedle


IIndexBuilder

Namespace: Deedle.Indices

A builder represents various ways of constructing index, either from keys or from other indices. The operations that build a new index from an existing index also build VectorConstruction which specifies how to transform vectors aligned with the previous index to match the new index. The methods generally take VectorConstruction as an input, apply necessary transformations to it and return a new VectorConstruction.

Example

For example, given index, we can say:

1: 
2: 
3: 
4: 
5: 
6: 
// Create an index that excludes the value 42
let newIndex, vectorCmd = indexBuilder.DropItem(index, 42, VectorConstruction.Return(0))

// Now we can transform multiple vectors (e.g. all frame columns) using 'vectorCmd'
// (the integer '0' in `Return` is an offset in the array of vector arguments)
let newVector = vectorBuilder.Build(vectorCmd, [| vectorToTransform |])
val newIndex : obj
val vectorCmd : obj
val newVector : obj

Instance members

Instance memberDescription
x.Aggregate(...)
Signature: (index:IIndex<'K> * aggregation:Aggregation<'K> * source:VectorConstruction * selector:(DataSegmentKind * SeriesConstruction<'K> -> 'TNewKey * OptionalValue<'R>)) -> IIndex<'TNewKey> * IVector<'R>
Modifiers: abstract
Type parameters: 'K, 'TNewKey, 'R

Aggregate an ordered index into floating windows or chunks.

Parameters

  • index - Specifies the index to be aggregated
  • aggregation - Defines the kind of aggregation to apply (the type is a discriminated union with a couple of cases)
  • source - Source vector construction to be transformed
  • selector - Given information about window/chunk (including vector construction that can be used to build the data chunk), return a new key, together with a new value for the returned vector.
x.AsyncMaterialize(arg1)
Signature: SeriesConstruction<'K> -> AsyncSeriesConstruction<'K>
Modifiers: abstract
Type parameters: 'K

Given an index and vector construction, return a new index asynchronously to allow composing evaluation of lazy series. The command to be applied to vectors can be applied asynchronously using vectorBuilder.AsyncBuild

x.Create(arg1, arg2)
Signature: (ReadOnlyCollection<'K> * Option<bool>) -> IIndex<'K>
Modifiers: abstract
Type parameters: 'K

Create a new index using the specified keys. This overload takes data as ReadOnlyCollection and so it is more efficient if the caller already has the keys in an allocated collection. Optionally, the caller can specify if the index keys are ordered or not. When the value is not set, the construction should check and infer this from the data.

x.Create(arg1, arg2)
Signature: (seq<'K> * Option<bool>) -> IIndex<'K>
Modifiers: abstract
Type parameters: 'K

Create a new index using the specified keys. Optionally, the caller can specify if the index keys are ordered or not. When the value is not set, the construction should check and infer this from the data.

x.DropItem(arg1, arg2)
Signature: (SeriesConstruction<'K> * 'K) -> SeriesConstruction<'K>
Modifiers: abstract
Type parameters: 'K

Drop an item associated with the specified key from the index.

x.GetAddressRange(arg1, arg2)
Signature: (SeriesConstruction<'K> * RangeRestriction<Address>) -> SeriesConstruction<'K>
Modifiers: abstract
Type parameters: 'K

Create a new index that represents sub-range of an existing index. The range is specified as a pair of addresses, which means that it can be used by operations such as "series.Take(5)" (which do not rely on keys)

x.GetRange(arg1, arg2)
Signature: (SeriesConstruction<'K> * (('K * BoundaryBehavior) option * ('K * BoundaryBehavior) option)) -> SeriesConstruction<'K>
Modifiers: abstract
Type parameters: 'K

Create a new index that represents sub-range of an existing index. The range is specified as a pair of options (when None, the original left/right boundary should be used) that contain boundary behavior and the boundary key.

x.GroupBy(index, keySelector, arg3)
Signature: (index:IIndex<'K> * keySelector:('K -> OptionalValue<'TNewKey>) * VectorConstruction) -> ReadOnlyCollection<'TNewKey * SeriesConstruction<'K>>
Modifiers: abstract
Type parameters: 'K, 'TNewKey

Group a (possibly unordered) index according to a provided sequence of labels. The operation results in a sequence of unique labels along with corresponding series construction objects which can be applied to arbitrary vectors/columns.

x.Intersect(arg1, arg2)
Signature: (SeriesConstruction<'K> * SeriesConstruction<'K>) -> IIndex<'K> * VectorConstruction * VectorConstruction
Modifiers: abstract
Type parameters: 'K

Creates an interesection of two indices and builds corresponding vector transformations for both vectors that match the left and the right index.

x.LookupLevel(arg1, arg2)
Signature: (SeriesConstruction<'K> * ICustomLookup<'K>) -> SeriesConstruction<'K>
Modifiers: abstract
Type parameters: 'K

Get items associated with the specified key from the index. This method takes ICustomLookup<K> which provides an implementation of ICustomKey<K>. This is used for custom equality testing (for example, when getting a level of a hierarchical index)

x.Merge(arg1, arg2, arg3)
Signature: (SeriesConstruction<'K> list * VectorListTransform * bool) -> IIndex<'K> * VectorConstruction
Modifiers: abstract
Type parameters: 'K

Append two indices and builds corresponding vector transformations for both vectors that match the left and the right index. If the indices are ordered, the ordering should be preserved (the keys should be aligned). The specified VectorListTransform defines how to deal with the case when a key is defined in both indices (i.e. which value should be in the new vector).

x.OrderIndex(arg1)
Signature: SeriesConstruction<'K> -> SeriesConstruction<'K>
Modifiers: abstract
Type parameters: 'K

Order (possibly unordered) index and return transformation that reorders vector

x.Project(arg1)
Signature: IIndex<'K> -> IIndex<'K>
Modifiers: abstract
Type parameters: 'K

When we perform some projection on the vector (Select or Convert), then we may also need to perform some transformation on the index (because it may turn delayed index into an evaluated index). If the vector operation does that, then Project should do the same (e.g. evaluate) on the index.

x.Recreate(arg1)
Signature: IIndex<'K> -> IIndex<'K>
Modifiers: abstract
Type parameters: 'K

When we create a new vector (IVectorBuilder.Create), then we may get a materialized vector and we may need to perform the same transformation on the index. This is similar to Project, but used in different scenarios.

x.Reindex(arg1, arg2, arg3, arg4, arg5)
Signature: (IIndex<'K> * IIndex<'K> * Lookup * VectorConstruction * (Address -> bool)) -> VectorConstruction
Modifiers: abstract
Type parameters: 'K

Given an old index and a new index, build a vector transformation that reorders elements from a vector associated with the old index so that they match the new index. When finding element location in the new index, the provided Lookup strategy is used. This is used, for example, when doing left/right join (to align the new data with another index) or when selecting multiple keys (Series.lookupAll).

The proivded condition is used when searching for a value in the old index (when lookup is not exact). It is called to check that the address contains an appropriate value (e.g. when we need to skip over missing values).

x.Resample(...)
Signature: (IIndexBuilder * IIndex<'K> * seq<'K> * Direction * source:VectorConstruction * selector:('K * SeriesConstruction<'K> -> 'TNewKey * OptionalValue<'R>)) -> IIndex<'TNewKey> * IVector<'R>
Modifiers: abstract
Type parameters: 'K, 'TNewKey, 'R

Aggregate data into non-overlapping chunks by aligning them to the specified keys. The second parameter specifies the direction. If it is Direction.Forward than the key is the first element of a chunk; for Direction.Backward, the key is the last element (note that this does not hold at the boundaries where values before/after the key may also be included)

x.Search(arg1, arg2, arg3)
Signature: (SeriesConstruction<'K> * IVector<'V> * 'V) -> SeriesConstruction<'K>
Modifiers: abstract
Type parameters: 'K, 'V

Get a series construction that restricts the range of the input to only locations where the specified vector contains the specified value. (used to filter frame rows according to a column value)

x.Shift(arg1, arg2)
Signature: (SeriesConstruction<'K> * int) -> SeriesConstruction<'K>
Modifiers: abstract
Type parameters: 'K

Shift the values in the series by a specified offset, in a specified direction. The resulting series should be shorter by abs(offset); key for which there is no value should be dropped. For example:

1: 
2: 
3: 
(original)  (shift 1) (shift -1)
a b c       _ b c     a b _
1 2 3         1 2     1 2
x.Union(arg1, arg2)
Signature: (SeriesConstruction<'K> * SeriesConstruction<'K>) -> IIndex<'K> * VectorConstruction * VectorConstruction
Modifiers: abstract
Type parameters: 'K

Creates a union of two indices and builds corresponding vector transformations for both vectors that match the left and the right index.

x.WithIndex(arg1, arg2, arg3)
Signature: (IIndex<'K> * IVector<'TNewKey> * VectorConstruction) -> SeriesConstruction<'TNewKey>
Modifiers: abstract
Type parameters: 'K, 'TNewKey

Create a new index by picking a new key value for each key in the original index (used e.g. when we have a frame and want to use specified column as a new index).

Fork me on GitHub