| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
DataFrame.Operations.Join
Synopsis
- data JoinType
- = INNER
- | LEFT
- | RIGHT
- | FULL_OUTER
- join :: JoinType -> [Text] -> DataFrame -> DataFrame -> DataFrame
- innerJoin :: [Text] -> DataFrame -> DataFrame -> DataFrame
- leftJoin :: [Text] -> DataFrame -> DataFrame -> DataFrame
- rightJoin :: [Text] -> DataFrame -> DataFrame -> DataFrame
- fullOuterJoin :: [Text] -> DataFrame -> DataFrame -> DataFrame
Documentation
join :: JoinType -> [Text] -> DataFrame -> DataFrame -> DataFrame Source #
Join two dataframes using SQL join semantics.
Only inner join is implemented for now.
innerJoin :: [Text] -> DataFrame -> DataFrame -> DataFrame Source #
Performs an inner join on two dataframes using the specified key columns. Returns only rows where the key values exist in both dataframes.
Example
ghci> df = D.fromNamedColumns [("key", D.fromList [K0, K1, K2, K3]), (A, D.fromList [A0, A1, A2, A3])]
ghci> other = D.fromNamedColumns [("key", D.fromList [K0, K1, K2]), (B, D.fromList [B0, B1, B2])]
ghci> D.innerJoin ["key"] df other
-----------------
key | A | B
------|-----|----
Text | Text| Text
------|-----|----
K0 | A0 | B0
K1 | A1 | B1
K2 | A2 | B2
leftJoin :: [Text] -> DataFrame -> DataFrame -> DataFrame Source #
Performs a left join on two dataframes using the specified key columns. Returns all rows from the left dataframe, with matching rows from the right dataframe. Non-matching rows will have Nothing/null values for columns from the right dataframe.
Example
ghci> df = D.fromNamedColumns [("key", D.fromList [K0, K1, K2, K3]), (A, D.fromList [A0, A1, A2, A3])]
ghci> other = D.fromNamedColumns [("key", D.fromList [K0, K1, K2]), (B, D.fromList [B0, B1, B2])]
ghci> D.leftJoin ["key"] df other
------------------------
key | A | B
------|-----|----------
Text | Text| Maybe Text
------|-----|----------
K0 | A0 | Just B0
K1 | A1 | Just B1
K2 | A2 | Just B2
K3 | A3 | Nothing
rightJoin :: [Text] -> DataFrame -> DataFrame -> DataFrame Source #
Performs a right join on two dataframes using the specified key columns. Returns all rows from the right dataframe, with matching rows from the left dataframe. Non-matching rows will have Nothing/null values for columns from the left dataframe.
Example
ghci> df = D.fromNamedColumns [("key", D.fromList [K0, K1, K2, K3]), (A, D.fromList [A0, A1, A2, A3])]
ghci> other = D.fromNamedColumns [("key", D.fromList [K0, K1]), (B, D.fromList [B0, B1])]
ghci> D.rightJoin ["key"] df other
-----------------
key | A | B
------|-----|----
Text | Text| Text
------|-----|----
K0 | A0 | B0
K1 | A1 | B1