Frame

class Frame[RX, CX, @specialized(Int, Long, Double) T](val values: MatCols[T], val rowIx: Index[RX], val colIx: Index[CX], var cachedMat: Option[Mat[T]])(implicit evidence$1: ScalarTag[RX], evidence$2: Order[RX], evidence$3: ScalarTag[CX], evidence$4: Order[CX], st: ScalarTag[T]) extends NumericOps[Frame[RX, CX, T]]

Frame is an immutable container for 2D data which is indexed along both axes (rows, columns) by associated keys (i.e., indexes).

The primary use case is homogeneous data, but a secondary concern is to support heterogeneous data that is homogeneous ony within any given column.

The row index, column index, and constituent value data are all backed ultimately by arrays.

Frame is effectively a doubly-indexed associative map whose row keys and col keys each have an ordering provided by the natural (provided) order of their backing arrays.

Several factory and access methods are provided. In the following examples, assume that:

 val f = Frame('a'->Vec(1,2,3), 'b'->Vec(4,5,6))

The apply method takes a row and col key returns a slice of the original Frame:

 f(0,'a') == Frame('a'->Vec(1))

apply also accepts a org.saddle.index.Slice:

 f(0->1, 'b') == Frame('b'->Vec(4,5))
 f(0, *) == Frame('a'->Vec(1), 'b'->Vec(4))

You may slice using the col and row methods respectively, as follows:

 f.col('a') == Frame('a'->Vec(1,2,3))
 f.row(0) == Frame('a'->Vec(1), 'b'->Vec(4))
 f.row(0->1) == Frame('a'->Vec(1,2), 'b'->Vec(4,5))

You can achieve a similar effect with rowSliceBy and colSliceBy

The colAt and rowAt methods take an integer offset i into the Frame, and return a Series indexed by the opposing axis:

 f.rowAt(0) == Series('a'->1, 'b'->4)

If there is a one-to-one relationship between offset i and key (ie, no duplicate keys in the index), you may achieve the same effect via key as follows:

 f.first(0) == Series('a'->1, 'b'->4)
 f.firstCol('a') == Series(1,2,3)

The at method returns an instance of a org.saddle.scalar.Scalar, which behaves much like an Option; it can be either an instance of org.saddle.scalar.NA or a org.saddle.scalar.Value case class:

 f.at(0, 0) == scalar.Scalar(1)

The rowSlice and colSlice methods allows slicing the Frame for locations in [i, j) irrespective of the value of the keys at those locations.

 f.rowSlice(0,1) == Frame('a'->Vec(1), 'b'->Vec(4))

Finally, the method raw accesses a value directly, which may reveal the underlying representation of a missing value (so be careful).

 f.raw(0,0) == 1

Frame may be used in arithmetic expressions which operate on two Frames or on a Frame and a scalar value. In the former case, the two Frames will automatically align along their indexes:

 f + f.shift(1) == Frame('a'->Vec(NA,3,5), 'b'->Vec(NA,9,11))
Type parameters:
CX

The type of column keys

RX

The type of row keys

T

The type of entries in the frame

Value parameters:
colIx

An index for the columns

rowIx

An index for the rows

values

A sequence of Vecs which comprise the columns of the Frame

Companion:
object
trait NumericOps[Frame[RX, CX, T]]
class Object
trait Matchable
class Any

Value members

Concrete methods

def T: Frame[CX, RX, T]

The transpose of the frame (swapping the axes)

The transpose of the frame (swapping the axes)

def addCol(other: Series[RX, T], newColIx: CX, how: JoinType): Frame[RX, CX, T]

Same as addCol, but preserve the column index, adding the specified index value, newColIx as an index for the other Series.

Same as addCol, but preserve the column index, adding the specified index value, newColIx as an index for the other Series.

def addCol(other: Series[RX, T], how: JoinType): Frame[RX, Int, T]

Add a new column. Resets column index

Add a new column. Resets column index

The result is a Frame whose row index is the result of the join, and whose column index has been reset to [0, numcols], and whose values are sourced from the original Frame and Series.

Value parameters:
how

How to perform the join

other

Series to join with

def addRow(other: Series[CX, T], newRowIx: RX, how: JoinType): Frame[RX, CX, T]

See addCol, operates row-wise.

See addCol, operates row-wise.

def addRow(other: Series[CX, T], how: JoinType): Frame[Int, CX, T]

See addRow; operates row-wise.

See addRow; operates row-wise.

def align[U : ScalarTag](other: Frame[RX, CX, U], rhow: JoinType, chow: JoinType): (Frame[RX, CX, T], Frame[RX, CX, U])

Aligns this frame with another frame, returning the left and right frames aligned to each others indexes according to the the provided parameters

Aligns this frame with another frame, returning the left and right frames aligned to each others indexes according to the the provided parameters

Value parameters:
chow

How to perform the join on the col indexes

other

Other frame to align with

rhow

How to perform the join on the row indexes

def apply(rix: Slice[RX], cix: Slice[CX]): Frame[RX, CX, T]

Slice frame by row and column slice specifiers

Slice frame by row and column slice specifiers

Value parameters:
cix

A col slice

rix

A row slice

def apply(rix: Slice[RX], cix: Array[CX]): Frame[RX, CX, T]

Slice frame by row slice and array of column keys

Slice frame by row slice and array of column keys

Value parameters:
cix

An array of column keys

rix

A row slice

def apply(rix: Array[RX], cix: Slice[CX]): Frame[RX, CX, T]

Slice frame by array of row keys and a col slice

Slice frame by array of row keys and a col slice

Value parameters:
cix

A col slice

rix

An array of row keys

def apply(rix: Array[RX], cix: Array[CX]): Frame[RX, CX, T]

Slice from by an array of row keys and an array of col keys

Slice from by an array of row keys and an array of col keys

Value parameters:
cix

An array of col keys

rix

An array of row keys

def at(r: Int, c: Int): Scalar[T]

Access a (Scalar-boxed) value from within the Frame

Access a (Scalar-boxed) value from within the Frame

Value parameters:
c

Integer col offset

r

Integer row offset

def at(r: Array[Int], c: Array[Int]): Frame[RX, CX, T]

Access a slice of the Frame by integer offsets

Access a slice of the Frame by integer offsets

Value parameters:
c

Array of col offsets

r

Array of row offsets

def at(r: Array[Int], c: Int): Series[RX, T]

Access a slice of the Frame by integer offsets

Access a slice of the Frame by integer offsets

Value parameters:
c

Integer col offset

r

Array of row offsets

def at(r: Int, c: Array[Int]): Series[CX, T]

Access a slice of the Frame by integer offsets

Access a slice of the Frame by integer offsets

Value parameters:
c

Array of col offsets

r

Integer row offset

def at(r: Slice[Int], c: Slice[Int]): Frame[RX, CX, T]

Access a slice of the Frame by Slice parameters

Access a slice of the Frame by Slice parameters

Value parameters:
c

Slice to apply to cols

r

Slice to apply to rows

def cbind(other: Frame[RX, CX, T], how: JoinType): Frame[RX, CX, T]

Same as rconcat. Concatenates two Frames by concatenating their lists of columns A1 A2 rconcat B1 B2 = A1 A2 B1 B2 A3 A4 B3 B4 A3 A4 B3 B4

Same as rconcat. Concatenates two Frames by concatenating their lists of columns A1 A2 rconcat B1 B2 = A1 A2 B1 B2 A3 A4 B3 B4 A3 A4 B3 B4

def col(keys: CX*): Frame[RX, CX, T]

Given one or more column keys, slice out the corresponding column(s)

Given one or more column keys, slice out the corresponding column(s)

Value parameters:
keys

Column key(s) (sequence)

def col(slice: Slice[CX]): Frame[RX, CX, T]

Given a Slice of type of column key, slice out corresponding column(s)

Given a Slice of type of column key, slice out corresponding column(s)

Value parameters:
slice

Slice containing appropriate key bounds

def col(keys: Array[CX]): Frame[RX, CX, T]

Given an array of column keys, slice out the corresponding column(s)

Given an array of column keys, slice out the corresponding column(s)

Value parameters:
keys

Array of keys

def colAt(loc: Int): Series[RX, T]

Access frame column at a particular integer offset

Access frame column at a particular integer offset

Value parameters:
loc

integer offset

def colAt(locs: Int*): Frame[RX, CX, T]

Access frame columns at a particular integer offsets

Access frame columns at a particular integer offsets

Value parameters:
locs

a sequence of integer offsets

def colAt(locs: Array[Int]): Frame[RX, CX, T]

Access frame columns at a particular integer offsets

Access frame columns at a particular integer offsets

Value parameters:
locs

an array of integer offsets

def colAt(slice: Slice[Int]): Frame[RX, CX, T]

Access frame columns specified by a slice

Access frame columns specified by a slice

Value parameters:
slice

a slice specifier

def colSlice(from: Int, until: Int, stride: Int): Frame[RX, CX, T]

Access frame columns between two integer offsets, [from, until)

Access frame columns between two integer offsets, [from, until)

Value parameters:
from

Beginning offset

stride

Optional increment between offsets

until

One past ending offset

def colSliceBy(from: CX, to: CX, inclusive: Boolean): Frame[RX, CX, T]

Slice out a set of columns from the frame

Slice out a set of columns from the frame

Value parameters:
from

Key from which to begin slicing

inclusive

Whether to include 'to' key; true by default

to

Key at which to end slicing

def colSplitAt(c: Int): (Frame[RX, CX, T], Frame[RX, CX, T])

Split Frame into two frames at column position c

Split Frame into two frames at column position c

Value parameters:
c

Position at which to split Frame

def colSplitBy(k: CX): (Frame[RX, CX, T], Frame[RX, CX, T])

Split Frame into two frames at column key k

Split Frame into two frames at column key k

Value parameters:
k

Key at which to split Frame k is included in the right Frame [1,2,3,4] split at 2 yields [1] and [2,3,4]

def colType[U : ScalarTag]: Frame[RX, CX, U]

Extract columns from a heterogeneous Frame which match the provided type. The result is a homogeneous frame consisting of the selected data.

Extract columns from a heterogeneous Frame which match the provided type. The result is a homogeneous frame consisting of the selected data.

Type parameters:
U

The type of columns to extract

def colType[U1 : ScalarTag, U2 : ScalarTag]: Frame[RX, CX, Any]

Extract columns from a heterogeneous Frame which match either of the provided types. The result is a heterogeneous frame consisting of the selected data.

Extract columns from a heterogeneous Frame which match either of the provided types. The result is a heterogeneous frame consisting of the selected data.

Type parameters:
U1

First type of columns to extract

U2

Second type of columns to extract

def concat(other: Frame[RX, CX, T], how: JoinType): Frame[RX, CX, T]

Concatenate the Frame instances together (vertically, i.e. concatenate as lists of rows) whose indexes share the same type of elements, and where there exists some way to join the values of the Frames. For instance, Frame[X, Y, Double] concat Frame[X, Y, Int] will promote Int to Double as a result of the implicit existence of a Promoter[Double, Int, Double] instance. The resulting row index will simply be the concatenation of the input row indexes, and the column index will be the joint index (with join type specified as argument).

Concatenate the Frame instances together (vertically, i.e. concatenate as lists of rows) whose indexes share the same type of elements, and where there exists some way to join the values of the Frames. For instance, Frame[X, Y, Double] concat Frame[X, Y, Int] will promote Int to Double as a result of the implicit existence of a Promoter[Double, Int, Double] instance. The resulting row index will simply be the concatenation of the input row indexes, and the column index will be the joint index (with join type specified as argument).

A1 A2 concat B1 B2 = A1 A2 A3 A4 B3 B4 A3 A4 B1 B2 B3 B4

Type parameters:
U

type of other Frame values

V

type of resulting Frame values

Value parameters:
other

Frame[RX, CX, U] to concat

pro

Implicit evidence of Promoter

def count: Series[CX, Int]

Count of the elements of each column, ignoring NA values

Count of the elements of each column, ignoring NA values

def cshift(n: Int): Frame[RX, CX, T]

See shift; operates col-wise

See shift; operates col-wise

def distinct: Frame[RX, CX, T]

Return the frame with the first occurence of each column key. Rows are not changed.

Return the frame with the first occurence of each column key. Rows are not changed.

def dropNA: Frame[RX, CX, T]

Return Frame excluding any of those columns which have an NA value

Return Frame excluding any of those columns which have an NA value

def emptyCol: Series[RX, T]

Return empty series of type equivalent to a column of frame

Return empty series of type equivalent to a column of frame

def emptyRow: Series[CX, T]

Return empty series of type equivalent to a row of frame

Return empty series of type equivalent to a row of frame

override def equals(other: Any): Boolean
Definition Classes
Any
def fillNA(v: T): Frame[RX, CX, T]

Fill NAs with a defined value.

Fill NAs with a defined value.

def fillNA(fillMethod: FillMethod, limit: Int): Frame[RX, CX, T]

Fill NA values by propagating defined values column-wise.

Fill NA values by propagating defined values column-wise.

Value parameters:
limit

If > 0, propagate over a maximum of limit consecutive NA values.

def filter(pred: Series[RX, T] => Boolean): Frame[RX, CX, T]

Return Frame whose columns satisfy a predicate function operating on that column

Return Frame whose columns satisfy a predicate function operating on that column

Value parameters:
pred

Predicate function from Series[RX, T] => Boolean

def filterAt(pred: Int => Boolean): Frame[RX, CX, T]

Return Frame whose columns satisfy a predicate function operating on the column index offset

Return Frame whose columns satisfy a predicate function operating on the column index offset

Value parameters:
pred

Predicate function from CX => Boolean

def filterIx(pred: CX => Boolean): Frame[RX, CX, T]

Return Frame whose columns satisfy a predicate function operating on the column index

Return Frame whose columns satisfy a predicate function operating on the column index

Value parameters:
pred

Predicate function from CX => Boolean

def first(k: RX): Series[CX, T]

Extract first row matching a particular key

Extract first row matching a particular key

Value parameters:
k

Key to match

def firstCol(k: CX): Series[RX, T]

Extract first col matching a particular key

Extract first col matching a particular key

Value parameters:
k

Key to match

def flatMap[SX : ScalarTag, DX : ScalarTag, U : ScalarTag](f: (RX, CX, T) => Iterable[(SX, DX, U)]): Frame[SX, DX, U]

Map over each triple (r, c, v) in the Frame, flattening results, and returning a new frame from the resulting triples.

Map over each triple (r, c, v) in the Frame, flattening results, and returning a new frame from the resulting triples.

def get(r: RX, c: CX): Scalar[T]

Return scalar of first row and column found

Return scalar of first row and column found

Value parameters:
c

Column to match

r

Row to match

def groupBy: FrameGrouper[RX, RX, CX, T]

Construct a org.saddle.groupby.FrameGrouper with which further computations, such as combine or transform, may be performed. The groups are constructed from the keys of the row index, with each unique key corresponding to a group.

Construct a org.saddle.groupby.FrameGrouper with which further computations, such as combine or transform, may be performed. The groups are constructed from the keys of the row index, with each unique key corresponding to a group.

def groupBy[Y : Order](fn: RX => Y): FrameGrouper[Y, RX, CX, T]

Construct a org.saddle.groupby.FrameGrouper with which further computations, such as combine or transform, may be performed. The groups are constructed from the result of the function applied to the keys of the row index; each unique result of calling the function on elements of the row index corresponds to a group.

Construct a org.saddle.groupby.FrameGrouper with which further computations, such as combine or transform, may be performed. The groups are constructed from the result of the function applied to the keys of the row index; each unique result of calling the function on elements of the row index corresponds to a group.

Type parameters:
Y

Type of function codomain

Value parameters:
fn

Function from RX => Y

def groupBy[Y : Order](ix: Index[Y]): FrameGrouper[Y, RX, CX, T]

Construct a org.saddle.groupby.FrameGrouper with which further computations, such as combine or transform, may be performed. The groups are constructed from the keys of the provided index, with each unique key corresponding to a group.

Construct a org.saddle.groupby.FrameGrouper with which further computations, such as combine or transform, may be performed. The groups are constructed from the keys of the provided index, with each unique key corresponding to a group.

Type parameters:
Y

Type of elements of ix

Value parameters:
ix

Index with which to perform grouping

override def hashCode(): Int
Definition Classes
Any
def head(n: Int): Frame[RX, CX, T]

Extract first n rows

Extract first n rows

Value parameters:
n

number of rows to extract

def headCol(n: Int): Frame[RX, CX, T]

Extract first n columns

Extract first n columns

Value parameters:
n

number of columns to extract

def isEmpty: Boolean

Returns true if there are no values in the Frame

Returns true if there are no values in the Frame

def joinMap[U : ScalarTag, V : ScalarTag](other: Frame[RX, CX, U], rhow: JoinType, chow: JoinType)(f: (T, U) => V): Frame[RX, CX, V]

Joins two frames along both their indexes and applies a function to each pair of values; when either value is NA, the result of the function is forced to be NA.

Joins two frames along both their indexes and applies a function to each pair of values; when either value is NA, the result of the function is forced to be NA.

Type parameters:
U

The type of other frame values

V

The result type of the function

Value parameters:
chow

The type of join to effect on the cols

f

The function to apply

other

Other Frame

rhow

The type of join to effect on the rows

def last(k: RX): Series[CX, T]

Extract last row matching a particular key

Extract last row matching a particular key

Value parameters:
k

Key to match

def lastCol(k: CX): Series[RX, T]

Extract first col matching a particular key

Extract first col matching a particular key

Value parameters:
k

Key to match

def map[SX : Order, DX : ScalarTag, U : ScalarTag](f: (RX, CX, T) => (SX, DX, U)): Frame[SX, DX, U]

Map over each triple (r, c, v) in the Frame, returning a new frame from the resulting triples.

Map over each triple (r, c, v) in the Frame, returning a new frame from the resulting triples.

def mapColIndex[Y : Order](fn: CX => Y): Frame[RX, Y, T]

Map a function over the col index, resulting in a new Frame

Map a function over the col index, resulting in a new Frame

Type parameters:
Y

Result type of index, ie Index[Y]

Value parameters:
fn

The function CX => Y with which to map

def mapCols[Y : ScalarTag](fn: (CX, Vec[T]) => Vec[Y]): Frame[RX, CX, Y]

Map a function over the columns, resulting in a new Frame

Map a function over the columns, resulting in a new Frame

Type parameters:
Y

Result type of mapped value

Value parameters:
fn

The function (CX,Vec[T]) => Vec[Y] with which to map

def mapRowIndex[Y : Order](fn: RX => Y): Frame[Y, CX, T]

Map a function over the row index, resulting in a new Frame

Map a function over the row index, resulting in a new Frame

Type parameters:
Y

Result type of index, ie Index[Y]

Value parameters:
fn

The function RX => Y with which to map

def mapRows[Y : ScalarTag](fn: (RX, Vec[T]) => Vec[Y]): Frame[RX, CX, Y]

Map a function over the rows, resulting in a new Frame

Map a function over the rows, resulting in a new Frame

Type parameters:
Y

Result type of mapped value

Value parameters:
fn

The function (RX,Vec[T]) => Vec[Y] with which to map

def mapValues[U : ScalarTag](f: T => U): Frame[RX, CX, U]

Map over the values of the Frame. Applies a function to each (non-na) value in the frame, returning a new frame whose indices remain the same.

Map over the values of the Frame. Applies a function to each (non-na) value in the frame, returning a new frame whose indices remain the same.

Type parameters:
U

The type of the resulting values

Value parameters:
f

Function from T to U

def mapVec[U : ScalarTag](f: Vec[T] => Vec[U]): Frame[RX, CX, U]

Map a function over each column vector and collect the results into a Frame respecting the original indexes.

Map a function over each column vector and collect the results into a Frame respecting the original indexes.

Type parameters:
U

Type of result Vec of the function

Value parameters:
f

Function acting on Vec[T] and producing another Vec

def mask(f: T => Boolean): Frame[RX, CX, T]

Create a new Frame that, whenever the mask predicate function evaluates to true on a value, is masked with NA

Create a new Frame that, whenever the mask predicate function evaluates to true on a value, is masked with NA

Value parameters:
f

Function from T to Boolean

def mask(m: Vec[Boolean]): Frame[RX, CX, T]

Create a new Frame whose columns follow the rule that, wherever the mask Vec is true, the column value is masked with NA

Create a new Frame whose columns follow the rule that, wherever the mask Vec is true, the column value is masked with NA

Value parameters:
m

Mask Vec[Boolean]

def max(implicit num: Numeric[T]): Series[CX, T]

Max of the elements of each column, ignoring NA values

Max of the elements of each column, ignoring NA values

def mean(implicit num: Numeric[T]): Series[CX, Double]

Mean of each column

Mean of each column

def median(implicit num: Numeric[T]): Series[CX, Double]

Median of each column

Median of each column

def melt[W](implicit melter: Melter[RX, CX, W]): Series[W, T]

Melt stacks the row index of arity N with the column index of arity M to form a result index of arity N + M, producing a 1D Series whose values are from the original Frame as indexed by the corresponding keys.

Melt stacks the row index of arity N with the column index of arity M to form a result index of arity N + M, producing a 1D Series whose values are from the original Frame as indexed by the corresponding keys.

For example, given:

 Frame(1 -> Series('a' -> 1, 'b' -> 3), 2 -> Series('a' -> 2, 'b' -> 4)).melt

produces:

res0: org.saddle.Series[(Char, Int),Int] =
[4 x 1]
 a 1 => 1
   2 => 2
 b 1 => 3
   2 => 4
Type parameters:
W

Output type (tuple of arity N + M)

Value parameters:
melter

Implicit evidence for a Melter for the two indexes

def min(implicit num: Numeric[T]): Series[CX, T]

Min of the elements of each column, ignoring NA values

Min of the elements of each column, ignoring NA values

def numCols: Int

Number of cols in the Frame

Number of cols in the Frame

def numRows: Int

Number of rows in the Frame

Number of rows in the Frame

def prod(implicit num: Numeric[T]): Series[CX, T]

Product of the elements of each column, ignoring NA values

Product of the elements of each column, ignoring NA values

def raw(r: Int, c: Int): T

Access the raw (unboxed) value at an offset within the Frame

Access the raw (unboxed) value at an offset within the Frame

Value parameters:
c

Integer col offset

r

Integer row offset

def rbind(other: Frame[RX, CX, T], how: JoinType): Frame[RX, CX, T]

Same as concat. Concatenates two Frames by concatenating their lists of rows A1 A2 concat B1 B2 = A1 A2 A3 A4 B3 B4 A3 A4 B1 B2 B3 B4

Same as concat. Concatenates two Frames by concatenating their lists of rows A1 A2 concat B1 B2 = A1 A2 A3 A4 B3 B4 A3 A4 B1 B2 B3 B4

def rconcat(other: Frame[RX, CX, T], how: JoinType): Frame[RX, CX, T]

See concat; operates row-wise. Concetanates two Frames by concatenating their lists of columns A1 A2 rconcat B1 B2 = A1 A2 B1 B2 A3 A4 B3 B4 A3 A4 B3 B4

See concat; operates row-wise. Concetanates two Frames by concatenating their lists of columns A1 A2 rconcat B1 B2 = A1 A2 B1 B2 A3 A4 B3 B4 A3 A4 B3 B4

def rdistinct: Frame[RX, CX, T]

Return the series with the first occurence of each row key. Columns are not changed.

Return the series with the first occurence of each row key. Columns are not changed.

def rdropNA: Frame[RX, CX, T]

See dropNA; operates row-wise

See dropNA; operates row-wise

def reduce[U : ScalarTag](f: Series[RX, T] => U): Series[CX, U]

Apply a function to each column series which results in a single value, and return the series of results indexed by original column index.

Apply a function to each column series which results in a single value, and return the series of results indexed by original column index.

Type parameters:
U

The output type of the function

Value parameters:
f

Function taking a column (series) to a value

def reindex(rix: Index[RX], cix: Index[CX]): Frame[RX, CX, T]

Create a new Frame whose indexes are formed from the provided arguments, and whose values are derived from the original Frame. Keys in the provided indices which do not map to existing values will map to NA in the new Frame.

Create a new Frame whose indexes are formed from the provided arguments, and whose values are derived from the original Frame. Keys in the provided indices which do not map to existing values will map to NA in the new Frame.

Value parameters:
cix

Sequence of keys to be the col index of the result Frame

rix

Sequence of keys to be the row index of the result Frame

def reindexCol(cix: Index[CX]): Frame[RX, CX, T]

Create a new Frame whose col index is formed of the provided argument, and whose values are derived from the original Frame.

Create a new Frame whose col index is formed of the provided argument, and whose values are derived from the original Frame.

Value parameters:
cix

Sequence of keys to be the col index of the result Frame

def reindexRow(rix: Index[RX]): Frame[RX, CX, T]

Create a new Frame whose row index is formed of the provided argument, and whose values are derived from the original Frame.

Create a new Frame whose row index is formed of the provided argument, and whose values are derived from the original Frame.

Value parameters:
rix

Sequence of keys to be the row index of the result Frame

def resetColIndex: Frame[RX, Int, T]

Create a new Frame whose values are the same, but whose col index has been changed to the bound [0, numCols - 1), as in an array.

Create a new Frame whose values are the same, but whose col index has been changed to the bound [0, numCols - 1), as in an array.

def resetRowIndex: Frame[Int, CX, T]

Create a new Frame whose values are the same, but whose row index has been changed to the bound [0, numRows - 1), as in an array.

Create a new Frame whose values are the same, but whose row index has been changed to the bound [0, numRows - 1), as in an array.

def rfilter(pred: Series[CX, T] => Boolean): Frame[RX, CX, T]

See filter; operates row-wise

See filter; operates row-wise

def rfilterAt(pred: Int => Boolean): Frame[RX, CX, T]

See filterAt; operates row-wise

See filterAt; operates row-wise

def rfilterIx(pred: RX => Boolean): Frame[RX, CX, T]

See filterIx; operates row-wise

See filterIx; operates row-wise

def rmapVec[U : ScalarTag](f: Vec[T] => Vec[U]): Frame[RX, CX, U]

See mapVec; operates row-wise

See mapVec; operates row-wise

def rmask(b: Vec[Boolean]): Frame[RX, CX, T]

See mask; operates row-wise

See mask; operates row-wise

def rolling[B : ScalarTag](windowSize: Int, f: Series[RX, T] => B): Frame[RX, CX, B]

Produce a Frame each of whose columns are the result of executing a function on a sliding window of each column series.

Produce a Frame each of whose columns are the result of executing a function on a sliding window of each column series.

Type parameters:
B

Result type of function

Value parameters:
f

Function Series[X, T] => B to operate on sliding window

winSz

Window size

def rollingFtoS[B : ScalarTag](windowSize: Int, f: Frame[RX, CX, T] => B): Series[RX, B]

Create a Series by rolling over winSz number of rows of the Frame at a time, and applying a function that takes those rows to a single value.

Create a Series by rolling over winSz number of rows of the Frame at a time, and applying a function that takes those rows to a single value.

Type parameters:
B

Result element type of Series

Value parameters:
f

Function taking the (sub) frame to B

winSz

Window size to roll with

def row(keys: RX*): Frame[RX, CX, T]

Given one or more row keys, slice out the corresponding row(s)

Given one or more row keys, slice out the corresponding row(s)

Value parameters:
keys

Row key(s) (sequence)

def row(slice: Slice[RX]): Frame[RX, CX, T]

Given a Slice of type of row key, slice out corresponding row(s)

Given a Slice of type of row key, slice out corresponding row(s)

Value parameters:
slice

Slice containing appropriate key bounds

def row(keys: Array[RX]): Frame[RX, CX, T]

Given an array of row keys, slice out the corresponding row(s)

Given an array of row keys, slice out the corresponding row(s)

Value parameters:
keys

Array of keys

def rowAt(loc: Int): Series[CX, T]

Access frame row at a particular integer offset

Access frame row at a particular integer offset

Value parameters:
loc

integer offset

def rowAt(locs: Int*): Frame[RX, CX, T]

Access frame rows at a particular integer offsets

Access frame rows at a particular integer offsets

Value parameters:
locs

a sequence of integer offsets

def rowAt(locs: Array[Int]): Frame[RX, CX, T]

Access frame rows at a particular integer offsets

Access frame rows at a particular integer offsets

Value parameters:
locs

an array of integer offsets

def rowAt(slice: Slice[Int]): Frame[RX, CX, T]

Access frame rows specified by a slice

Access frame rows specified by a slice

Value parameters:
slice

a slice specifier

def rowIterator: Iterator[(RX, Series[CX, T])]
def rowSlice(from: Int, until: Int, stride: Int): Frame[RX, CX, T]

Access frame rows between two integer offsets, [from, until)

Access frame rows between two integer offsets, [from, until)

Value parameters:
from

Beginning offset

stride

Optional increment between offsets

until

One past ending offset

def rowSliceBy(from: RX, to: RX, inclusive: Boolean): Frame[RX, CX, T]

Slice out a set of rows from the frame

Slice out a set of rows from the frame

Value parameters:
from

Key from which to begin slicing

inclusive

Whether to include 'to' key; true by default

to

Key at which to end slicing

def rowSplitAt(r: Int): (Frame[RX, CX, T], Frame[RX, CX, T])

Split Frame into two frames at row position r

Split Frame into two frames at row position r

Value parameters:
r

Position at which to split Frame

def rowSplitBy(k: RX): (Frame[RX, CX, T], Frame[RX, CX, T])

Split Frame into two frames at row key k

Split Frame into two frames at row key k

Value parameters:
k

Key at which to split Frame

def rreduce[U : ScalarTag](f: Series[CX, T] => U): Series[RX, U]

See reduce; operates row-wise

See reduce; operates row-wise

def rsqueeze: Frame[RX, CX, T]

See squeeze; operates row-wise

See squeeze; operates row-wise

def rtransform[U : ScalarTag, SX : Order](f: Series[CX, T] => Series[SX, U]): Frame[RX, SX, U]

See transform; operates row-wise

See transform; operates row-wise

def rwhere(pred: Series[_, Boolean]): Frame[RX, CX, T]

See where; operates row-wise

See where; operates row-wise

def rwhere(pred: Vec[Boolean]): Frame[RX, CX, T]

See where; operates row-wise

See where; operates row-wise

def setColIndex[Y : Order](newIx: Index[Y]): Frame[RX, Y, T]

Create a new Frame using the current values but with the new col index. Positions of the values do not change. Length of new index must be equal to number of cols.

Create a new Frame using the current values but with the new col index. Positions of the values do not change. Length of new index must be equal to number of cols.

Type parameters:
Y

Type of elements of new Index

Value parameters:
newIx

A new Index

def setRowIndex[Y : Order](newIx: Index[Y]): Frame[Y, CX, T]

Create a new Frame using the current values but with the new row index. Positions of the values do not change. Length of new index must be equal to number of rows.

Create a new Frame using the current values but with the new row index. Positions of the values do not change. Length of new index must be equal to number of rows.

Type parameters:
Y

Type of elements of new Index

Value parameters:
newIx

A new Index

def shift(n: Int): Frame[RX, CX, T]

Shift the sequence of values relative to the row index by some offset, dropping those values which no longer associate with a key, and having those keys which no longer associate to a value instead map to NA.

Shift the sequence of values relative to the row index by some offset, dropping those values which no longer associate with a key, and having those keys which no longer associate to a value instead map to NA.

Value parameters:
n

Number to shift

def sortedCIx: Frame[RX, CX, T]

Create a new Frame whose cols are sorted according to the col index keys

Create a new Frame whose cols are sorted according to the col index keys

def sortedCIxReverse: Frame[RX, CX, T]

Create a new Frame whose cols are sorted according to the reveverse of col index keys

Create a new Frame whose cols are sorted according to the reveverse of col index keys

def sortedCols(locs: Int*)(implicit ev: Order[T]): Frame[RX, CX, T]

Create a new Frame whose cols are sorted primarily on the values in the first row specified in the argument list, and then on the values in the next row, etc.

Create a new Frame whose cols are sorted primarily on the values in the first row specified in the argument list, and then on the values in the next row, etc.

Value parameters:
locs

Location of rows containing values to sort on

def sortedColsBy[@specialized(Int, Long, Double) Q : Order](f: Series[RX, T] => Q): Frame[RX, CX, T]

Create a new Frame whose cols are sorted by the result of a function acting on each col.

Create a new Frame whose cols are sorted by the result of a function acting on each col.

Type parameters:
Q

Result type of the function

Value parameters:
f

Function from a single col (represented as series) to a value having an ordering

def sortedRIx: Frame[RX, CX, T]

Create a new Frame whose rows are sorted according to the row index keys

Create a new Frame whose rows are sorted according to the row index keys

def sortedRIxReverse: Frame[RX, CX, T]

Create a new Frame whose rows are sorted according to the reverse of row index keys

Create a new Frame whose rows are sorted according to the reverse of row index keys

def sortedRows(locs: Int*)(implicit ev: Order[T]): Frame[RX, CX, T]

Create a new Frame whose rows are sorted primarily on the values in the first column specified in the argument list, and then on the values in the next column, etc.

Create a new Frame whose rows are sorted primarily on the values in the first column specified in the argument list, and then on the values in the next column, etc.

Value parameters:
locs

Location of columns containing values to sort on

def sortedRowsBy[@specialized(Int, Long, Double) Q : Order](f: Series[CX, T] => Q): Frame[RX, CX, T]

Create a new Frame whose rows are sorted by the result of a function acting on each row.

Create a new Frame whose rows are sorted by the result of a function acting on each row.

Type parameters:
Q

Result type of the function

Value parameters:
f

Function from a single row (represented as series) to a value having an ordering

def squeeze: Frame[RX, CX, T]

Drop all columns from the Frame which have nothing but NA values.

Drop all columns from the Frame which have nothing but NA values.

def stack[O1, O2, V](implicit splt: Splitter[CX, O1, O2], stkr: Stacker[RX, O2, V], ord1: Order[O1], ord2: Order[O2], m1: ScalarTag[O1], m2: ScalarTag[O2]): Frame[V, O1, T]

Stack pivots the innermost column labels to the innermost row labels. That is, it splits a col index of tuple keys of arity N into a new col index having arity N-1 and a remaining index C, and forms a new row index by stacking the existing row index with C. The resulting Frame has values as in the original Frame indexed by the corresponding keys. It does the reverse of unstack.

Stack pivots the innermost column labels to the innermost row labels. That is, it splits a col index of tuple keys of arity N into a new col index having arity N-1 and a remaining index C, and forms a new row index by stacking the existing row index with C. The resulting Frame has values as in the original Frame indexed by the corresponding keys. It does the reverse of unstack.

Type parameters:
O1

The N-1 arity column index type

O2

The 1-arity type of split-out index C

V

The type of the stacked row index

Value parameters:
splt

An implicit instance of Splitter to do the splitting

stkr

An implicit instance of Stacker to do the stacking

def stringify(nrows: Int, ncols: Int): String

Creates a string representation of Frame

Creates a string representation of Frame

Value parameters:
ncols

Max number of rows to include

nrows

Max number of rows to include

def sum(implicit num: Numeric[T]): Series[CX, T]

Sum of the elements of each column, ignoring NA values

Sum of the elements of each column, ignoring NA values

def tail(n: Int): Frame[RX, CX, T]

Extract last n rows

Extract last n rows

Value parameters:
n

number of rows to extract

def tailCol(n: Int): Frame[RX, CX, T]

Extract last n columns

Extract last n columns

Value parameters:
n

number of columns to extract

def toColSeq: IndexedSeq[(CX, Series[RX, T])]

Produce an indexed sequence of pairs of column index value and column Series.

Produce an indexed sequence of pairs of column index value and column Series.

def toMat: Mat[T]

Extract the Mat embodied in the values of the Frame (dropping any indexing information)

Extract the Mat embodied in the values of the Frame (dropping any indexing information)

def toRowSeq: IndexedSeq[(RX, Series[CX, T])]

Produce an indexed sequence of pairs of row index value and row Series

Produce an indexed sequence of pairs of row index value and row Series

def toSeq: IndexedSeq[(RX, CX, T)]

Produce an indexed sequence of triples of values in the Frame in row-major order.

Produce an indexed sequence of triples of values in the Frame in row-major order.

override def toString: String
Definition Classes
Any
def transform[U : ScalarTag, SX : Order](f: Series[RX, T] => Series[SX, U]): Frame[SX, CX, U]

Apply a function to each column series which results in another series (having possibly a different index); return new frame whose row index is the the full outer join of all the intermediately produced series (fast when all series have the same index), and having the original column index.

Apply a function to each column series which results in another series (having possibly a different index); return new frame whose row index is the the full outer join of all the intermediately produced series (fast when all series have the same index), and having the original column index.

Type parameters:
SX

Type of index of result series of function

U

Type of values of result series of function

Value parameters:
f

Function to operate on each column as a series

def unstack[O1, O2, V](implicit splt: Splitter[RX, O1, O2], stkr: Stacker[CX, O2, V], ord1: Order[O1], ord2: Order[O2], m1: ScalarTag[O1], m2: ScalarTag[O2]): Frame[O1, V, T]

Unstack pivots the innermost row labels to the innermost col labels. That is, it splits a row index of tuple keys of arity N into a new row index having arity N-1 and a remaining index R, and forms a new col index by stacking the existing col index with R. The resulting Frame has values as in the original Frame indexed by the corresponding keys.

Unstack pivots the innermost row labels to the innermost col labels. That is, it splits a row index of tuple keys of arity N into a new row index having arity N-1 and a remaining index R, and forms a new col index by stacking the existing col index with R. The resulting Frame has values as in the original Frame indexed by the corresponding keys.

For example:

scala> Frame(Series(Vec(1,2,3,4), Index(('a',1),('a',2),('b',1),('b',2))), Series(Vec(5,6,7,8), Index(('a',1),('a',2),('b',1),('b',2))))
res1: org.saddle.Frame[(Char, Int),Int,Int] =
[4 x 2]
       0  1
       -- --
a 1 ->  1  5
 2 ->  2  6
b 1 ->  3  7
 2 ->  4  8

scala> res1.unstack
res2: org.saddle.Frame[Char,(Int, Int),Int] =
[2 x 4]
     0     1
     1  2  1  2
     -- -- -- --
a ->  1  2  5  6
b ->  3  4  7  8
Type parameters:
O1

The N-1 arity row index type

O2

The 1-arity type of split-out index R

V

The type of the stacked col index

Value parameters:
splt

An implicit instance of Splitter to do the splitting

stkr

An implicit instance of Stacker to do the stacking

def where(pred: Series[_, Boolean]): Frame[RX, CX, T]

Create Frame whose rows satisfy the rule that their keys and values are chosen via a Vec[Boolean] or a Series[_, Boolean] predicate when the latter contains a true value.

Create Frame whose rows satisfy the rule that their keys and values are chosen via a Vec[Boolean] or a Series[_, Boolean] predicate when the latter contains a true value.

Value parameters:
pred

Series[_, Boolean] (or Vec[Boolean] which will implicitly convert)

def where(pred: Vec[Boolean]): Frame[RX, CX, T]

Create Frame whose rows satisfy the rule that their keys and values are chosen via a Vec[Boolean] or a Series[_, Boolean] predicate when the latter contains a true value.

Create Frame whose rows satisfy the rule that their keys and values are chosen via a Vec[Boolean] or a Series[_, Boolean] predicate when the latter contains a true value.

Value parameters:
pred

Series[_, Boolean] (or Vec[Boolean] which will implicitly convert)

def withColIndex(row: Int)(implicit ordT: Order[T]): Frame[RX, T, T]

Create a new Frame using the current values but with the new col index specified by the row at a particular offset, and with that row removed from the frame data body.

Create a new Frame using the current values but with the new col index specified by the row at a particular offset, and with that row removed from the frame data body.

def withColIndex(row1: Int, row2: Int)(implicit ordT: Order[T]): Frame[RX, (T, T), T]

Overloaded method to create hierarchical index from two rows.

Overloaded method to create hierarchical index from two rows.

def withRowIndex(col: Int)(implicit ordT: Order[T]): Frame[T, CX, T]

Create a new Frame using the current values but with the new row index specified by the column at a particular offset, and with that column removed from the frame data body.

Create a new Frame using the current values but with the new row index specified by the column at a particular offset, and with that column removed from the frame data body.

def withRowIndex(col1: Int, col2: Int)(implicit ordT: Order[T]): Frame[(T, T), CX, T]

Overloaded method to create hierarchical index from two cols.

Overloaded method to create hierarchical index from two cols.

Inherited methods

def %[B, That](other: B)(implicit op: BinOp[Mod, Frame[RX, CX, T], B, That]): That

Integer modulus of division

Integer modulus of division

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance (divisor)

Inherited from:
NumericOps
def %=[B](other: B)(implicit op: BinOpInPlace[Mod, Frame[RX, CX, T], B]): Unit
Inherited from:
NumericOps
def &[B, That](other: B)(implicit op: BinOp[BitAnd, Frame[RX, CX, T], B, That]): That

Bit-wise AND

Bit-wise AND

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def &&[B, That](other: B)(implicit op: BinOp[AndOp, Frame[RX, CX, T], B, That]): That

Logical AND

Logical AND

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def *[B, That](other: B)(implicit op: BinOp[Multiply, Frame[RX, CX, T], B, That]): That

Multiplication

Multiplication

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def **[B, That](other: B)(implicit op: BinOp[Power, Frame[RX, CX, T], B, That]): That

Exponentiation

Exponentiation

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance (exponent)

Inherited from:
NumericOps
def **=[B](other: B)(implicit op: BinOpInPlace[Power, Frame[RX, CX, T], B]): Unit
Inherited from:
NumericOps
def *=[B](other: B)(implicit op: BinOpInPlace[Multiply, Frame[RX, CX, T], B]): Unit
Inherited from:
NumericOps
def +[B, That](other: B)(implicit op: BinOp[Add, Frame[RX, CX, T], B, That]): That

Addition

Addition

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def +=[B](other: B)(implicit op: BinOpInPlace[Add, Frame[RX, CX, T], B]): Unit
Inherited from:
NumericOps
def -[B, That](other: B)(implicit op: BinOp[Subtract, Frame[RX, CX, T], B, That]): That

Subtraction

Subtraction

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def -=[B](other: B)(implicit op: BinOpInPlace[Subtract, Frame[RX, CX, T], B]): Unit
Inherited from:
NumericOps
def /[B, That](other: B)(implicit op: BinOp[Divide, Frame[RX, CX, T], B, That]): That

Division

Division

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance (divisor)

Inherited from:
NumericOps
def /=[B](other: B)(implicit op: BinOpInPlace[Divide, Frame[RX, CX, T], B]): Unit
Inherited from:
NumericOps
def <[B, That](other: B)(implicit op: BinOp[LtOp, Frame[RX, CX, T], B, That]): That

Less-than comparison operator

Less-than comparison operator

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def <<[B, That](other: B)(implicit op: BinOp[BitShl, Frame[RX, CX, T], B, That]): That

Bit-shift left

Bit-shift left

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def <=[B, That](other: B)(implicit op: BinOp[LteOp, Frame[RX, CX, T], B, That]): That

Less-than-or-equal-to comparison operator

Less-than-or-equal-to comparison operator

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def <>[B, That](other: B)(implicit op: BinOp[NeqOp, Frame[RX, CX, T], B, That]): That

Element-wise inequality operator

Element-wise inequality operator

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def =?[B, That](other: B)(implicit op: BinOp[EqOp, Frame[RX, CX, T], B, That]): That

Element-wise equality operator

Element-wise equality operator

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def >[B, That](other: B)(implicit op: BinOp[GtOp, Frame[RX, CX, T], B, That]): That

Greater-than comparison operator

Greater-than comparison operator

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def >=[B, That](other: B)(implicit op: BinOp[GteOp, Frame[RX, CX, T], B, That]): That

Greater-than-or-equal-to comparison operator

Greater-than-or-equal-to comparison operator

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def >>[B, That](other: B)(implicit op: BinOp[BitShr, Frame[RX, CX, T], B, That]): That

Bit-shift right (arithmetic)

Bit-shift right (arithmetic)

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def >>>[B, That](other: B)(implicit op: BinOp[BitUShr, Frame[RX, CX, T], B, That]): That

Bit-shift right (logical)

Bit-shift right (logical)

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def ^[B, That](other: B)(implicit op: BinOp[BitXor, Frame[RX, CX, T], B, That]): That

Bit-wise EXCLUSIVE OR

Bit-wise EXCLUSIVE OR

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def dot[B, That](other: B)(implicit op: BinOp[InnerProd, Frame[RX, CX, T], B, That]): That

Dot (inner) product

Dot (inner) product

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def outer[B, That](other: B)(implicit op: BinOp[OuterProd, Frame[RX, CX, T], B, That]): That

Outer product

Outer product

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def xor[B, That](other: B)(implicit op: BinOp[XorOp, Frame[RX, CX, T], B, That]): That

Logical EXCLUSIVE OR

Logical EXCLUSIVE OR

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def |[B, That](other: B)(implicit op: BinOp[BitOr, Frame[RX, CX, T], B, That]): That

Bit-wise OR

Bit-wise OR

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps
def ||[B, That](other: B)(implicit op: BinOp[OrOp, Frame[RX, CX, T], B, That]): That

Logical OR

Logical OR

Type parameters:
B

type of the other operand

That

result type of operation

Value parameters:
op

implicit evidence for operation between this and other

other

other operand instance

Inherited from:
NumericOps

Concrete fields

val colIx: Index[CX]
val rowIx: Index[RX]