dataframe-1.0.0.1: A fast, safe, and intuitive DataFrame library.
Safe HaskellNone
LanguageHaskell2010

DataFrame.Functions

Synopsis

Documentation

collect :: Columnable a => Expr a -> Expr [a] Source #

fromMaybe :: Columnable a => a -> Expr (Maybe a) -> Expr a Source #

lift :: (Columnable a, Columnable b) => (a -> b) -> Expr a -> Expr b Source #

max :: (Columnable a, Ord a) => Expr a -> Expr a -> Expr a Source #

min :: (Columnable a, Ord a) => Expr a -> Expr a -> Expr a Source #

sum :: (Columnable a, Num a) => Expr a -> Expr a Source #

maximum :: (Columnable a, Ord a) => Expr a -> Expr a Source #

minimum :: (Columnable a, Ord a) => Expr a -> Expr a Source #

div :: (Integral a, Columnable a) => Expr a -> Expr a -> Expr a infix 8 Source #

mod :: (Integral a, Columnable a) => Expr a -> Expr a -> Expr a Source #

reduce :: (Columnable a, Columnable b) => Expr b -> a -> (a -> b -> a) -> Expr a Source #

cast :: Columnable a => Text -> Expr (Maybe a) Source #

Lenient numeric / text coercion returning Maybe a. Looks up column name and coerces its values to a. Values that cannot be converted (parse failures, type mismatches) become Nothing; successfully converted values are wrapped in Just. Existing Nothing in optional source columns stays as Nothing.

eq :: (Columnable a, Eq a, a ~ BaseType a) => Expr a -> Expr a -> Expr Bool Source #

bind :: forall a b m. (Columnable a, Columnable (m a), Monad m, Columnable b, Columnable (m b)) => (a -> m b) -> Expr (m a) -> Expr (m b) Source #

mode :: (Ord a, Columnable a, Eq a) => Expr a -> Expr a Source #

unsafeCast :: Columnable a => Text -> Expr a Source #

Lenient coercion for assertedly non-nullable columns. Substitutes error for Nothing, so it will crash at evaluation time if any Nothing is actually encountered. For non-nullable and fully-populated nullable columns no cost is paid.

variance :: (Columnable a, Real a, Unbox a) => Expr a -> Expr Double Source #

geq :: (Columnable a, Ord a, Eq a, a ~ BaseType a) => Expr a -> Expr a -> Expr Bool Source #

median :: (Columnable a, Real a, Unbox a) => Expr a -> Expr Double Source #

lift2 :: (Columnable c, Columnable b, Columnable a) => (c -> b -> a) -> Expr c -> Expr b -> Expr a Source #

nullLift :: (NullLift1Op a r (NullLift1Result a r), Columnable (NullLift1Result a r)) => (BaseType a -> r) -> Expr a -> Expr (NullLift1Result a r) Source #

Lift a unary function over a nullable or non-nullable column expression. When the input is Maybe a, Nothing short-circuits (like fmap). When the input is plain a, the function is applied directly.

The return type is inferred via NullLift1Result: no annotation needed.

nullLift2 :: (NullLift2Op a b r (NullLift2Result a b r), Columnable (NullLift2Result a b r)) => (BaseType a -> BaseType b -> r) -> Expr a -> Expr b -> Expr (NullLift2Result a b r) Source #

Lift a binary function over nullable or non-nullable column expressions. Any Nothing operand short-circuits to Nothing in the result.

The return type is inferred via NullLift2Result: no annotation needed.

castExpr :: (Columnable b, Columnable src) => Expr src -> Expr (Maybe b) Source #

lt :: (Columnable a, Ord a, a ~ BaseType a) => Expr a -> Expr a -> Expr Bool Source #

gt :: (Columnable a, Ord a, a ~ BaseType a) => Expr a -> Expr a -> Expr Bool Source #

leq :: (Columnable a, Ord a, Eq a, a ~ BaseType a) => Expr a -> Expr a -> Expr Bool Source #

pow :: (Columnable a, Num a) => Expr a -> Int -> Expr a Source #

castWithDefault :: Columnable a => a -> Text -> Expr a Source #

Lenient coercion that substitutes a default for unconvertible values. Looks up column name, coerces its values to a, and uses def wherever conversion fails or the source value is Nothing.

castEither :: Columnable a => Text -> Expr (Either Text a) Source #

Lenient coercion returning Either T.Text a. Successfully converted values are Right; values that cannot be parsed are kept as Left with their original string representation, so the caller can inspect or handle them downstream. Existing Nothing in optional source columns becomes Left "null".

sumMaybe :: (Columnable a, Num a) => Expr (Maybe a) -> Expr a Source #

stddev :: (Columnable a, Real a, Unbox a) => Expr a -> Expr Double Source #

relu :: (Columnable a, Num a, Ord a) => Expr a -> Expr a Source #

whenPresent :: (Columnable a, Columnable b) => (a -> b) -> Expr (Maybe a) -> Expr (Maybe b) Source #

whenBothPresent :: (Columnable a, Columnable b, Columnable c) => (a -> b -> c) -> Expr (Maybe a) -> Expr (Maybe b) -> Expr (Maybe c) Source #

recode :: (Columnable a, Columnable b) => [(a, b)] -> Expr a -> Expr (Maybe b) Source #

recodeWithCondition :: (Columnable a, Columnable b) => Expr b -> [(Expr a -> Expr Bool, b)] -> Expr a -> Expr b Source #

recodeWithDefault :: (Columnable a, Columnable b) => b -> [(a, b)] -> Expr a -> Expr b Source #