class Index(T)

Overview

An Index implements a Hash that allows rows to be quickly looked up in a Frame or Series in constant time.

Many types of indexes will be supported, but currently only Integer indexes are implemented.

Defined in:

frame/index.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.range(n : Int) #

Create a range index from a size. This index will always monotonically increase and be unique.

Arguments

n : Int Size of the index

Examples

Index.range(5) # => Index[0, 1, 2, 3, 4]

[View source]

Instance Method Detail

def [](i : T) #

Find the corresponding row value of an index at a provided index value.

Arguments

i : T Key to lookup

Examples

i = Index.range(5)
i[0] # => 0

[View source]
def iat(index : Int) #

Returns the appropriate Entry of an index at a given integer value. This relies on the fact that Crystal hashes are insertion sorted.


[View source]