dataframe-0.3.3.6: A fast, safe, and intuitive DataFrame library.
Safe HaskellNone
LanguageHaskell2010

DataFrame.Internal.Row

Synopsis

Documentation

data Any where Source #

Constructors

Value :: forall a. Columnable a => a -> Any 

Instances

Instances details
Read Any Source # 
Instance details

Defined in DataFrame.Internal.Row

Show Any Source # 
Instance details

Defined in DataFrame.Internal.Row

Methods

showsPrec :: Int -> Any -> ShowS #

show :: Any -> String #

showList :: [Any] -> ShowS #

Eq Any Source # 
Instance details

Defined in DataFrame.Internal.Row

Methods

(==) :: Any -> Any -> Bool #

(/=) :: Any -> Any -> Bool #

Ord Any Source # 
Instance details

Defined in DataFrame.Internal.Row

Methods

compare :: Any -> Any -> Ordering #

(<) :: Any -> Any -> Bool #

(<=) :: Any -> Any -> Bool #

(>) :: Any -> Any -> Bool #

(>=) :: Any -> Any -> Bool #

max :: Any -> Any -> Any #

min :: Any -> Any -> Any #

toAny :: Columnable a => a -> Any Source #

Wraps a value into an Any type. This helps up represent rows as heterogenous lists.

fromAny :: Columnable a => Any -> Maybe a Source #

Unwraps a value from an Any type.

type Row = Vector Any Source #

(!?) :: [a] -> Int -> Maybe a Source #

toRowList :: DataFrame -> [Row] Source #

Converts the entire dataframe to a list of rows.

Each row contains all columns in the dataframe, ordered by their column indices. The rows are returned in their natural order (from index 0 to n-1).

Examples

Expand
>>> toRowList df
[Row {name = "Alice", age = 25, ...}, Row {name = "Bob", age = 30, ...}, ...]

Performance note

Expand

This function materializes all rows into a list, which may be memory-intensive for large dataframes. Consider using toRowVector if you need random access or streaming operations.

toRowVector :: [Text] -> DataFrame -> Vector Row Source #

Converts the dataframe to a vector of rows with only the specified columns.

Each row will contain only the columns named in the names parameter. This is useful when you only need a subset of columns or want to control the column order in the resulting rows.

Parameters

Expand
names
List of column names to include in each row. The order of names determines the order of fields in the resulting rows.
df
The dataframe to convert.

Examples

Expand
>>> toRowVector ["name", "age"] df
Vector of rows with only name and age fields
>>> toRowVector [] df  -- Empty column list
Vector of empty rows (one per dataframe row)