| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DataFrame.Internal.Row
Synopsis
- data Any where
- Value :: forall a. Columnable a => a -> Any
- showValue :: Columnable a => a -> Text
- toAny :: Columnable a => a -> Any
- fromAny :: Columnable a => Any -> Maybe a
- type Row = Vector Any
- (!?) :: [a] -> Int -> Maybe a
- mkColumnFromRow :: Int -> [[Any]] -> Column
- toRowList :: DataFrame -> [Row]
- toRowVector :: [Text] -> DataFrame -> Vector Row
- mkRowFromArgs :: [Text] -> DataFrame -> Int -> Row
- mkRowRep :: DataFrame -> Set Text -> Int -> Row
- sortedIndexes' :: Bool -> Vector Row -> Vector Int
Documentation
Constructors
| Value :: forall a. Columnable a => a -> Any |
showValue :: Columnable a => a -> Text Source #
toAny :: Columnable a => a -> Any Source #
Wraps a value into an Any type. This helps up represent rows as heterogenous lists.
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
>>>toRowList df[Row {name = "Alice", age = 25, ...}, Row {name = "Bob", age = 30, ...}, ...]
Performance note
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
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
>>>toRowVector ["name", "age"] dfVector of rows with only name and age fields
>>>toRowVector [] df -- Empty column listVector of empty rows (one per dataframe row)