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

Add a @bycol macro-flag #357

Open
pdeffebach opened this issue Mar 17, 2023 · 5 comments
Open

Add a @bycol macro-flag #357

pdeffebach opened this issue Mar 17, 2023 · 5 comments
Labels

Comments

@pdeffebach
Copy link
Collaborator

Can't believe this doesn't exist. I would really like it.

@MatthewRGonzalez do you want to make a PR?

@MatthewRGonzalez
Copy link
Contributor

Sure-- I'll check this out @pdeffebach

@pdeffebach pdeffebach added the 1.0 label Apr 9, 2023
@pdeffebach
Copy link
Collaborator Author

@MatthewRGonzalez I've marked this as 1.0.

I want to get a 1.0 release together soon. People are going to get mad if we do too many v0.x.0 releases. But I think this is a feature that should go into 1.0

@MatthewRGonzalez
Copy link
Contributor

MatthewRGonzalez commented Apr 11, 2023

@pdeffebach Do you have any examples in mind for applications of the @bycol flag? Are you looking for something like:

@chain df begin
           transform(@bycol r"x" .=> mean)
       end

as opposed to

@chain df begin
           transform(Cols(r"x") .=> mean)
       end

@pdeffebach
Copy link
Collaborator Author

No, @bycol is the opposite of @byrow.

@transform df @bycol :y = f(:x)

gets lowered to

transform(df, :x => f => :y)

that is, it's redundant by itself. But if you have a block it matters

@rtransform df begin
    :z = g(:a)
    @bycol :y = f(:x)
end

gets lowered to

transform(df, 
    :a => ByRow(g) => :z,
    :x => f => :y)

@MatthewRGonzalez
Copy link
Contributor

Got it-- I'll start working!

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

No branches or pull requests

2 participants