Skip to content

Commit 40c368d

Browse files
authored
avoid allocation when negating BitArray in dropmissing! (#2497)
1 parent e07b08d commit 40c368d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/abstractdataframe/abstractdataframe.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,9 @@ julia> dropmissing!(df3, [:x, :y])
911911
function dropmissing!(df::AbstractDataFrame,
912912
cols::Union{ColumnIndex, MultiColumnIndex}=:;
913913
disallowmissing::Bool=true)
914-
delete!(df, (!).(completecases(df, cols)))
914+
inds = completecases(df, cols)
915+
inds .= .!(inds)
916+
delete!(df, inds)
915917
disallowmissing && disallowmissing!(df, cols)
916918
df
917919
end

0 commit comments

Comments
 (0)