dataframe-operations-2.4.0.0: Column operations, expression DSL, and statistics for the dataframe ecosystem.
Safe HaskellNone
LanguageHaskell2010

DataFrame.Typed.Access

Synopsis

Typed column access

columnAsVector :: forall (name :: Symbol) (cols :: [(Symbol, Type)]) a. (KnownSymbol name, a ~ SafeLookup name cols, Columnable a, AssertPresent name cols) => TypedDataFrame cols -> Vector a Source #

Retrieve a column as a boxed Vector, with the type determined by the schema. The column must exist (enforced at compile time).

columnAsList :: forall (name :: Symbol) (cols :: [(Symbol, Type)]) a. (KnownSymbol name, a ~ SafeLookup name cols, Columnable a, AssertPresent name cols) => TypedDataFrame cols -> [a] Source #

Retrieve a column as a list, with the type determined by the schema.

Numeric vector extraction

columnAsIntVector :: forall (name :: Symbol) (cols :: [(Symbol, Type)]) a. (KnownSymbol name, a ~ SafeLookup name cols, Columnable a, AssertRealColumn "columnAsIntVector" name a, Real a, Unbox a, AssertPresent name cols) => TypedDataFrame cols -> Vector Int Source #

Retrieve a column coerced to an unboxed Int vector, named by type application. The column must exist and be numeric — both are compile-time checks via SafeLookup, so this is total (no Either, no runtime throw).

columnAsDoubleVector :: forall (name :: Symbol) (cols :: [(Symbol, Type)]) a. (KnownSymbol name, a ~ SafeLookup name cols, Columnable a, AssertRealColumn "columnAsDoubleVector" name a, Real a, Unbox a, AssertPresent name cols) => TypedDataFrame cols -> Vector Double Source #

Retrieve a column coerced to an unboxed Double vector. See columnAsIntVector.

columnAsFloatVector :: forall (name :: Symbol) (cols :: [(Symbol, Type)]) a. (KnownSymbol name, a ~ SafeLookup name cols, Columnable a, AssertRealColumn "columnAsFloatVector" name a, Real a, Unbox a, AssertPresent name cols) => TypedDataFrame cols -> Vector Float Source #

Retrieve a column coerced to an unboxed Float vector. See columnAsIntVector.

columnAsUnboxedVector :: forall (name :: Symbol) (cols :: [(Symbol, Type)]) a. (KnownSymbol name, a ~ SafeLookup name cols, Columnable a, Unbox a, AssertPresent name cols) => TypedDataFrame cols -> Vector a Source #

Retrieve a column as an unboxed vector of its own element type. The column must exist and be unboxable — both compile-time checks, so this is total.

Matrix extraction

toDoubleMatrix :: forall (cols :: [(Symbol, Type)]). AllColumnsReal "toDoubleMatrix" cols => TypedDataFrame cols -> Vector (Vector Double) Source #

Convert every column to Double and transpose into a row-major matrix. Total: AllColumnsReal proves at compile time that every column is numeric and unboxed, so the conversion cannot fail.

toFloatMatrix :: forall (cols :: [(Symbol, Type)]). AllColumnsReal "toFloatMatrix" cols => TypedDataFrame cols -> Vector (Vector Float) Source #

Convert every column to Float and transpose into a row-major matrix. See toDoubleMatrix.

toIntMatrix :: forall (cols :: [(Symbol, Type)]). AllColumnsReal "toIntMatrix" cols => TypedDataFrame cols -> Vector (Vector Int) Source #

Convert every column to Int and transpose into a row-major matrix. See toDoubleMatrix.