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

DataFrame.Operations.Typing

Synopsis

Documentation

data SafeReadMode Source #

How parse failures are surfaced: NoSafeRead throws, MaybeRead yields Nothing (column wrapped Maybe a), EitherRead yields Left rawText (column wrapped Either Text a, preserving the original input).

data ParseOptions Source #

Options controlling how text columns are parsed into typed values.

Constructors

ParseOptions 

Fields

defaultParseOptions :: ParseOptions Source #

Sensible out-of-the-box parse options: infer from the first 100 rows, treat common nullish strings as missing, and expect ISO 8601 dates.

effectiveSafeRead :: SafeReadMode -> [(Text, SafeReadMode)] -> Text -> SafeReadMode Source #

Resolve a column's effective SafeReadMode: the override if present, otherwise the default.

isNullishOrMissing :: [Text] -> Text -> Bool Source #

True for nullish or explicitly-listed missing strings. (convertNullish and convertOnlyEmpty below are kept only for external callers.)

handleEitherAssumption :: DateFormat -> ParsingAssumption -> Vector Text -> Column Source #

For EitherRead mode: parse under the chosen assumption into an Either Text a column. Successful parses become Right; failures (including null/missing cells) become Left carrying the raw input verbatim.

handleIntAssumption :: (Text -> Bool) -> Vector Text -> Column Source #

Int columns: one fused pass with in-place Int -> Double promotion; a cell parsing as neither demotes the column to Text. readIntStrict rejects overflow so a huge integer promotes to Double rather than wrapping.

handleTextAssumption :: (Text -> Bool) -> Vector Text -> Column Source #

Text columns: no parse, just null-marking. An all-non-null column stays a plain V.Vector T.Text; otherwise it becomes V.Vector (Maybe T.Text).

handleDateAssumption :: DateFormat -> (Text -> Bool) -> Vector Text -> Column Source #

Date: single boxed parse pass (Day is not unboxable). Bails to handleTextAssumption the moment a non-null cell fails to parse as a Day. A column with no nulls keeps type Day rather than 'Maybe Day'.

parseUnboxedColumnWithPred :: forall src a. Unbox a => a -> (src -> Bool) -> (src -> Maybe a) -> Vector src -> Maybe (Maybe Bitmap, Vector a) Source #

unboxedOrFallback :: (Columnable a, Unbox a) => Maybe (Maybe Bitmap, Vector a) -> Column -> Column Source #

Wrap a successful parseUnboxedColumnWithPred result as a Column.

parseBoxedMaybeColumn :: (Text -> Bool) -> (Text -> Maybe a) -> Vector Text -> Maybe (Bool, Vector (Maybe a)) Source #

hasNullValues :: Eq a => Vector (Maybe a) -> Bool Source #

vecSameConstructor :: Vector (Maybe a) -> Vector (Maybe b) -> Bool Source #

parseWithTypes :: (Text -> SafeReadMode) -> Map Text SchemaType -> DataFrame -> DataFrame Source #

Re-type columns of a DataFrame according to a schema map. resolveMode maps a column name to its SafeReadMode (typically via effectiveSafeRead).

readEitherRaw :: Read a => String -> Either Text a Source #

Try readMaybe; on failure return Left raw where raw is the original input text. Used by parseWithTypes under EitherRead.