| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DataFrame.Internal.DataFrame
Synopsis
- data DataFrame = DataFrame {
- columns :: Vector Column
- columnIndices :: Map Text Int
- dataframeDimensions :: (Int, Int)
- derivingExpressions :: Map Text UExpr
- forceDataFrame :: DataFrame -> DataFrame
- data GroupedDataFrame = Grouped {
- fullDataframe :: DataFrame
- groupedColumns :: [Text]
- valueIndices :: Vector Int
- offsets :: Vector Int
- rowToGroup :: Vector Int
- data TruncateConfig = TruncateConfig {
- maxRows :: Int
- maxColumns :: Int
- maxCellWidth :: Int
- defaultTruncateConfig :: TruncateConfig
- ellipsisText :: Text
- toMarkdown :: DataFrame -> Text
- toMarkdown' :: DataFrame -> String
- asText :: RenderFormat -> DataFrame -> Text
- asTextWith :: RenderFormat -> Maybe TruncateConfig -> DataFrame -> Text
- pickColumns :: Maybe TruncateConfig -> Int -> [a] -> ([a], Maybe Int)
- insertAt :: Int -> a -> [a] -> [a]
- truncateCell :: Int -> Text -> Text
- empty :: DataFrame
- columnNames :: DataFrame -> [Text]
- insertColumn :: Text -> Column -> DataFrame -> DataFrame
- fromNamedColumns :: [(Text, Column)] -> DataFrame
- getColumn :: Text -> DataFrame -> Maybe Column
- unsafeGetColumn :: Text -> DataFrame -> Column
- null :: DataFrame -> Bool
- toCsv :: DataFrame -> Text
- toCsv' :: DataFrame -> String
- toSeparated :: Char -> DataFrame -> Text
- getRowAsText :: DataFrame -> Int -> [Text]
- showElement :: Column -> Int -> Text
- stripJust :: Text -> Text
Documentation
Constructors
| DataFrame | |
Fields
| |
forceDataFrame :: DataFrame -> DataFrame Source #
Force evaluation of all columns in a DataFrame. Replacement for the removed
instance NFData DataFrame; used by the IO and lazy-executor strict paths.
data GroupedDataFrame Source #
A record that contains information about how and what
rows are grouped in the dataframe. This can only be used with
aggregate.
Constructors
| Grouped | |
Fields
| |
Instances
| Show GroupedDataFrame Source # | |
Defined in DataFrame.Internal.DataFrame Methods showsPrec :: Int -> GroupedDataFrame -> ShowS # show :: GroupedDataFrame -> String # showList :: [GroupedDataFrame] -> ShowS # | |
| Eq GroupedDataFrame Source # | |
Defined in DataFrame.Internal.DataFrame Methods (==) :: GroupedDataFrame -> GroupedDataFrame -> Bool # (/=) :: GroupedDataFrame -> GroupedDataFrame -> Bool # | |
data TruncateConfig Source #
Configures how a DataFrame is rendered as text: maxRows caps rendered
rows, maxColumns collapses middle columns past the limit into an ellipsis, and
maxCellWidth truncates long cells. A non-positive field means "no limit".
Constructors
| TruncateConfig | |
Fields
| |
Instances
| Show TruncateConfig Source # | |
Defined in DataFrame.Internal.DataFrame Methods showsPrec :: Int -> TruncateConfig -> ShowS # show :: TruncateConfig -> String # showList :: [TruncateConfig] -> ShowS # | |
| Eq TruncateConfig Source # | |
Defined in DataFrame.Internal.DataFrame Methods (==) :: TruncateConfig -> TruncateConfig -> Bool # (/=) :: TruncateConfig -> TruncateConfig -> Bool # | |
defaultTruncateConfig :: TruncateConfig Source #
Sensible defaults for GHCi: 20 rows, 10 columns, 30 characters per cell.
ellipsisText :: Text Source #
Ellipsis character used to mark elided columns and clipped cells.
toMarkdown :: DataFrame -> Text Source #
For showing the dataframe as markdown in notebooks.
toMarkdown' :: DataFrame -> String Source #
For showing the dataframe as a string markdown in notebooks.
asTextWith :: RenderFormat -> Maybe TruncateConfig -> DataFrame -> Text Source #
pickColumns :: Maybe TruncateConfig -> Int -> [a] -> ([a], Maybe Int) Source #
Decide which columns survive horizontal truncation and where to splice the
ellipsis column. Splits with the extra column on the left for odd maxColumns;
inserts the ellipsis only when it actually saves space.
insertAt :: Int -> a -> [a] -> [a] Source #
Splice x into xs at index i (0-based), shifting later elements right.
truncateCell :: Int -> Text -> Text Source #
Cap a single cell's rendered length, appending an ellipsis when shortened.
columnNames :: DataFrame -> [Text] Source #
O(k) Get column names of the DataFrame in order of insertion.
insertColumn :: Text -> Column -> DataFrame -> DataFrame Source #
Insert a column into a DataFrame. If a column with the same name already exists it is replaced in-place; otherwise the column is appended at the end. Other columns are expanded (padded with nulls) to match the new row count.
fromNamedColumns :: [(Text, Column)] -> DataFrame Source #
Build a DataFrame from a list of (name, column) pairs using insertColumn.
getColumn :: Text -> DataFrame -> Maybe Column Source #
Safely retrieves a column by name from the dataframe.
Returns Nothing if the column does not exist.
Examples
>>>getColumn "age" dfJust (UnboxedColumn ...)
>>>getColumn "nonexistent" dfNothing
unsafeGetColumn :: Text -> DataFrame -> Column Source #
Retrieve a column by name, throwing ColumnsNotFoundException if it does not
exist. Unsafe version of getColumn; use when the column is certain to exist.