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

Implement empty / empty! as the truncate operation #2251

Closed
Nosferican opened this issue May 13, 2020 · 2 comments · Fixed by #2262
Closed

Implement empty / empty! as the truncate operation #2251

Nosferican opened this issue May 13, 2020 · 2 comments · Fixed by #2262
Labels
feature non-breaking The proposed change is not breaking

Comments

@Nosferican
Copy link
Contributor

Proposal to have these definitions implemented and added to the API

empty(df::AbstractDataFrame) = similar(df, 0)
empty!(df::AbstractDataFrame) = filter!(row -> false, df)
@bkamins bkamins added feature non-breaking The proposed change is not breaking labels May 13, 2020
@bkamins
Copy link
Member

bkamins commented May 13, 2020

I think the deprecation on empty! was long enough there that it is OK to add it back.
empty! will be implemented as (note that it is not for AbstractDataFrame as it may not be mutable)

empty!(df::DataFrame) = foreach(empty!, eachcol(df))

@bkamins
Copy link
Member

bkamins commented May 17, 2020

see #2262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature non-breaking The proposed change is not breaking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants