Deedle


IIndexBuilder

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:

// 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 |])

Instance members

Instance memberDescription
iIndexBuilder.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.
iIndexBuilder.Append(arg1, arg2, arg3)
Signature:(SeriesConstruction<'K> * SeriesConstruction<'K> * IVectorValueTransform) -> 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 IVectorValueTransform 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).

iIndexBuilder.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

iIndexBuilder.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.

iIndexBuilder.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.

iIndexBuilder.GetRange(...)
Signature:(IIndex<'K> * ('K * BoundaryBehavior) option * ('K * BoundaryBehavior) option * VectorConstruction) -> 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.

iIndexBuilder.GroupBy(...)
Signature:(IIndex<'K> * keySelector:('K -> OptionalValue<'TNewKey>) * VectorConstruction * valueSelector:('TNewKey * SeriesConstruction<'K> -> OptionalValue<'R>)) -> IIndex<'TNewKey> * IVector<'R>
Modifiers: abstract
Type parameters: 'K, 'TNewKey, 'R

Group a (possibly unordered) index using the specified keySelector function. The operation builds a new index with the selected keys and a matching vector with values produced by the valueSelector function.

iIndexBuilder.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.

iIndexBuilder.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)

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

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

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

When we perform some projection on the vector (e.g. Series.map), then we may also need to perform some transformation on the index (because it will typically turn delayed index into an evaluated index). This operation represents that - it should return (evaluated) index with the same keys.

iIndexBuilder.Reindex(...)
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).

iIndexBuilder.Resample(...)
Signature:(IIndex<'K> * seq<'K> * Direction * source:VectorConstruction * valueSelector:('TNewKey * SeriesConstruction<'K> -> OptionalValue<'R>) * keySelector:('K * SeriesConstruction<'K> -> 'TNewKey)) -> 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)

iIndexBuilder.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.

iIndexBuilder.WithIndex(...)
Signature:(IIndex<'K> * (Address -> OptionalValue<'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