| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DataFrame.Internal.Schema
Synopsis
- data SchemaType where
- SType :: forall a. Columnable a => Proxy a -> SchemaType
- schemaType :: Columnable a => SchemaType
- newtype Schema = Schema {}
Documentation
data SchemaType where Source #
A runtime tag for a column’s element type.
Constructors
| SType :: forall a. Columnable a => Proxy a -> SchemaType | Constructor carrying a |
Instances
| Show SchemaType Source # | Show the underlying element type using Examples
|
Defined in DataFrame.Internal.Schema Methods showsPrec :: Int -> SchemaType -> ShowS # show :: SchemaType -> String # showList :: [SchemaType] -> ShowS # | |
| Eq SchemaType Source # | Two Examples
|
Defined in DataFrame.Internal.Schema | |
schemaType :: Columnable a => SchemaType Source #
Construct a SchemaType for the given a.
Examples
>>>:set -XTypeApplications>>>schemaType @T.Text == schemaType @T.TextTrue
>>>show (schemaType @Double)"Double"
Logical schema of a DataFrame: a mapping from column names to their
element types (SchemaType).
Examples
Constructing and querying a schema:
>>>import qualified Data.Map as M>>>import qualified Data.Text as T>>>let s = Schema (M.fromList [("country", schemaType @T.Text), ("amount", schemaType @Double)])>>>M.lookup "amount" (elements s) == Just (schemaType @Double)True
Extending a schema:
>>>let s' = Schema (M.insert "discount" (schemaType @Double) (elements s))>>>M.member "discount" (elements s')True
Equality is structural over the map contents:
>>>let a = Schema (M.fromList [("x", schemaType @Int), ("y", schemaType @Double)])>>>let b = Schema (M.fromList [("y", schemaType @Double), ("x", schemaType @Int)])>>>a == bTrue
Constructors
| Schema | |
Fields
| |