| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DataFrame.Operations.Typing
Synopsis
- data SafeReadMode
- data ParseOptions = ParseOptions {
- missingValues :: [Text]
- sampleSize :: Int
- parseSafe :: SafeReadMode
- parseSafeOverrides :: [(Text, SafeReadMode)]
- parseDateFormat :: DateFormat
- defaultParseOptions :: ParseOptions
- effectiveSafeRead :: SafeReadMode -> [(Text, SafeReadMode)] -> Text -> SafeReadMode
- parseDefaults :: ParseOptions -> DataFrame -> DataFrame
- parseDefault :: ParseOptions -> Column -> Column
- parseFromExamples :: ParseOptions -> Vector Text -> Column
- isNullishOrMissing :: [Text] -> Text -> Bool
- handleEitherAssumption :: DateFormat -> ParsingAssumption -> Vector Text -> Column
- handleBoolAssumption :: (Text -> Bool) -> Vector Text -> Column
- handleIntAssumption :: (Text -> Bool) -> Vector Text -> Column
- handleDoubleAssumption :: (Text -> Bool) -> Vector Text -> Column
- handleTextAssumption :: (Text -> Bool) -> Vector Text -> Column
- handleDateAssumption :: DateFormat -> (Text -> Bool) -> Vector Text -> Column
- handleNoAssumption :: DateFormat -> (Text -> Bool) -> Vector Text -> Column
- parseUnboxedColumnWithPred :: forall src a. Unbox a => a -> (src -> Bool) -> (src -> Maybe a) -> Vector src -> Maybe (Maybe Bitmap, Vector a)
- unboxedOrFallback :: (Columnable a, Unbox a) => Maybe (Maybe Bitmap, Vector a) -> Column -> Column
- parseBoxedMaybeColumn :: (Text -> Bool) -> (Text -> Maybe a) -> Vector Text -> Maybe (Bool, Vector (Maybe a))
- convertNullish :: [Text] -> Text -> Maybe Text
- convertOnlyEmpty :: Text -> Maybe Text
- unsafeParseTime :: DateFormat -> Text -> Day
- hasNullValues :: Eq a => Vector (Maybe a) -> Bool
- vecSameConstructor :: Vector (Maybe a) -> Vector (Maybe b) -> Bool
- parseWithTypes :: (Text -> SafeReadMode) -> Map Text SchemaType -> DataFrame -> DataFrame
- readEitherRaw :: Read a => String -> Either Text a
- readAsMaybe :: Read a => String -> Maybe a
- readAsEither :: Read a => String -> a
- module DataFrame.Operations.Inference
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).
Constructors
| NoSafeRead | |
| MaybeRead | |
| EitherRead |
Instances
| Read SafeReadMode Source # | |
Defined in DataFrame.Operations.Typing Methods readsPrec :: Int -> ReadS SafeReadMode # readList :: ReadS [SafeReadMode] # | |
| Show SafeReadMode Source # | |
Defined in DataFrame.Operations.Typing Methods showsPrec :: Int -> SafeReadMode -> ShowS # show :: SafeReadMode -> String # showList :: [SafeReadMode] -> ShowS # | |
| Eq SafeReadMode Source # | |
Defined in DataFrame.Operations.Typing | |
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.
parseDefaults :: ParseOptions -> DataFrame -> DataFrame Source #
parseDefault :: ParseOptions -> Column -> Column Source #
parseFromExamples :: ParseOptions -> Vector Text -> Column Source #
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'.
handleNoAssumption :: DateFormat -> (Text -> Bool) -> Vector Text -> Column Source #
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 #
unsafeParseTime :: DateFormat -> Text -> Day 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.
readAsEither :: Read a => String -> a Source #