Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/DataFrame/Operations/Transformations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,14 @@ impute columnName value df = case getColumn columnName df of
Left exception -> throw exception
Right res -> res
_ -> error "Cannot impute to a non-Empty column"

imputeExpr :: forall a. (Columnable a) => T.Text -> Expr a -> DataFrame -> DataFrame
--imputeExpr = undefined
imputeExpr columnName expr df =
case getColumn columnName df of
Nothing -> throw $ ColumnNotFoundException columnName "impute" (map fst $ M.toList $ columnIndices df)
Just (OptionalColumn _) ->
case expr of
Col a -> impute columnName a df
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Col a is just a typed reference to a column. It sort of looks like: data Expr = Col String | .... As written, a === columnName. You probably want to interpret the expression, get the resulting column then zip it with the result of getColumn.

_ -> error "Cannot impute a non Col Expression"
_ -> error "Cannot impute to a non-Empty column"
Loading