Most efficient way to delete row without memory consuming

Would you suggest, how to delete row without consuming memory?

I try the code but have not enough memory error.


df = df[df.cl!=1,:]

thank you in advance!

julia> df = DataFrame(cl = rand(1:3, 10))
10×1 DataFrame
│ Row │ cl    │
│     │ Int64 │
├─────┼───────┤
│ 1   │ 1     │
│ 2   │ 3     │
│ 3   │ 1     │
│ 4   │ 3     │
│ 5   │ 3     │
│ 6   │ 2     │
│ 7   │ 2     │
│ 8   │ 1     │
│ 9   │ 2     │
│ 10  │ 2     │

julia> delete!(df, df.cl .== 1)
7×1 DataFrame
│ Row │ cl    │
│     │ Int64 │
├─────┼───────┤
│ 1   │ 3     │
│ 2   │ 3     │
│ 3   │ 3     │
│ 4   │ 2     │
│ 5   │ 2     │
│ 6   │ 2     │
│ 7   │ 2     │

What version of Julia and DataFrame do you use?
I have error delete!(df1, df1.cl .== 1)

(@v1.4) pkg> st DataFrames
Status `C:\Users\Alex\.julia\environments\v1.4\Project.toml`
  [a93c6f00] DataFrames v0.21.2

Have you tried updating DataFrames?

1 Like

I’ve update. Now it works! Thank you