queryverse / Query.jl

Query almost anything in julia
Other
394 stars 49 forks source link

Feature request: allow @mutate to create new columns #314

Closed ilyagr closed 3 years ago

ilyagr commented 4 years ago

I would like the following to work:

DataFrame(bad=[1,2], good=[0, 3]) |> @mutate(
            count = _.bad + _.good,
            bad_rate = _.bad/_.count,
            bad_pct =round(_.bad_rate*100;digits=1)
        ) 

I don't know a good way to do it currently. I created a forum post asking if anyone else does.

ilyagr commented 4 years ago

It seems that mutate can create new columns as in this example, but it cannot handle interdependent mutations despite the documentation suggesting it might.

OkonSamuel commented 3 years ago

sorry to intrude here. But shouldn't this be closed?