Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@map followed by @replacena with a function defined using a macro #328

Open
sswatson opened this issue Apr 6, 2021 · 0 comments
Open

@map followed by @replacena with a function defined using a macro #328

sswatson opened this issue Apr 6, 2021 · 0 comments

Comments

@sswatson
Copy link

sswatson commented Apr 6, 2021

It seems that column transformation functions defined using macros can behave differently than functions defined without macros. Here's an example:

using Match, DataFrames, Query
df = DataFrame(a = [1, 2], b = [3, missing])
f(x) = @match x begin 
    3 => "three"
    _ => missing
end
df |> 
    @map({_..., c = f(_.b)}) |>
    @replacena("successfully replaced")

The output still has NAs in it, despite the final @replacena command.

If I replace f with an equivalent version without macros (even just the one obtained by expanding the macro), this works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant