DataFramesMeta.jl icon indicating copy to clipboard operation
DataFramesMeta.jl copied to clipboard

Special case request for Not()

Open fieldofnodes opened this issue 1 year ago • 2 comments

When using DataFrames with the select function, we can specify select(df, Not(:Col)) .

I would like to see something similar here

 @chain df begin
     @select @not :Col1 :Col2... 
 end

Where we want to specify that we don't want certain columns.

fieldofnodes avatar Jan 01 '23 15:01 fieldofnodes

I agree that a special case for Not() is necessary. This request is similar to #283, which proposes—among other changes—the use of @select df Not(:a) as opposed to the current solution of @select df $(Not(:a)). With this in mind, two potential designs for this implementation are

@chain df begin
     @select @not :Col1 :Col2 ...
end

and

@chain df begin
     @select Not([:Col1, :Col2, ...])
end

I prefer @not as I believe it looks cleaner, buy am curious as to whether there are additional considerations regarding this proposal.

MatthewRGonzalez avatar Jan 07 '23 20:01 MatthewRGonzalez

I think Not is best here. @not might make some of the parsing kind of confusing. Plus we already allow AsTable to be special-cased.

I've marked this as 1.0, since I think its an important issue.

pdeffebach avatar Apr 09 '23 18:04 pdeffebach

Added in #372

pdeffebach avatar Mar 01 '24 14:03 pdeffebach