-
Notifications
You must be signed in to change notification settings - Fork 370
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 cols to mapcols and mapcols! #3386
Conversation
@nalimilan - do you know why DataFrames.jl tests on nightly keep failing? I though that |
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
src/abstractdataframe/iteration.jl
Outdated
else | ||
picked = Set(names(df, cols)) | ||
apply = Bool[name in picked for name in names(df)] | ||
@assert length(apply) == ncol(df) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why this could be false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No - it is just that later we use zip
which does not check this invariant.
If you prefer I can remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it seems to me that the comprehension that creates apply
already guarantees that invariant (unless names
is broken but then we have more serious problems...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - I removed the @assert
Thank you! |
add
cols
kwarg tomapcols
andmapcols!
similarly like we recently did for column renaming.This is a useful addition for cases when e.g. one wants to transform only columns meeting some condition and keep the column order unchanged.