dataframe-core-2.2.0.0: Core data structures for the dataframe library.
Safe HaskellNone
LanguageHaskell2010

DataFrame.Internal.DataFrame

Synopsis

Documentation

data DataFrame Source #

Constructors

DataFrame 

Fields

Instances

Instances details
Show DataFrame Source # 
Instance details

Defined in DataFrame.Internal.DataFrame

ToDataFrame DataFrame Source # 
Instance details

Defined in DataFrame.Typed.Freeze

Eq DataFrame Source # 
Instance details

Defined in DataFrame.Internal.DataFrame

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

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 

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.

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.

empty :: DataFrame Source #

O(1) Creates an empty dataframe

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

Expand
>>> getColumn "age" df
Just (UnboxedColumn ...)
>>> getColumn "nonexistent" df
Nothing

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.

null :: DataFrame -> Bool Source #

Checks if the dataframe is empty (has no columns).

Returns True if the dataframe has no columns, False otherwise. Note that a dataframe with columns but no rows is not considered null.

toCsv :: DataFrame -> Text Source #

Convert a DataFrame to a CSV (comma-separated) text.

toCsv' :: DataFrame -> String Source #

Convert a DataFrame to a CSV (comma-separated) string.

toSeparated :: Char -> DataFrame -> Text Source #

Convert a DataFrame to a text representation with a custom separator.