class Index(T)
- Index(T)
- Reference
- Object
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.crClass Method Summary
-
.range(n : Int)
Create a range index from a size.
Instance Method Summary
-
#[](i : T)
Find the corresponding row value of an index at a provided index value.
-
#iat(index : Int)
Returns the appropriate
Entryof an index at a given integer value.
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]
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
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.