# How do I drop only rows that are fully filled with missing values?

**URL:** <https://discourse.julialang.org/t/how-do-i-drop-only-rows-that-are-fully-filled-with-missing-values/93471>\
**Category:** General Usage\
**Tags:** question, package, dataframes\
**Created:** [January 24, 2023, 4:47pm UTC](https://discourse.julialang.org/t/how-do-i-drop-only-rows-that-are-fully-filled-with-missing-values/93471 "2023-01-24T16:47:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [January 24, 2023, 4:47pm UTC](https://discourse.julialang.org/t/how-do-i-drop-only-rows-that-are-fully-filled-with-missing-values/93471/1 "2023-01-24T16:47:20Z")

</div>

How do I drop only rows that are fully filled with missing values?

```julia
df = DataFrame(a = [missing,2,3,missing], b = [missing,5, 9, missing], c=[missing, 2,3,4])

```

just remove row 1.

I want to keep the other ones, even if there are some missings here and there.

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [January 24, 2023, 4:50pm UTC](https://discourse.julialang.org/t/how-do-i-drop-only-rows-that-are-fully-filled-with-missing-values/93471/2 "2023-01-24T16:50:28Z")

</div>

The simplest is:

```julia
julia> filter(row -> !all(ismissing, row), df)
3×3 DataFrame
 Row │ a b c
     │ Int64? Int64? Int64?
─────┼──────────────────────────
   1 │ 2 5 2
   2 │ 3 9 3
   3 │ missing missing 4

```

It is not fastest, but maybe it is good enough for your use case?

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [January 24, 2023, 4:51pm UTC](https://discourse.julialang.org/t/how-do-i-drop-only-rows-that-are-fully-filled-with-missing-values/93471/3 "2023-01-24T16:51:05Z")

</div>

With DataFrames.jl and DataFramesMeta.jl, respectively

```julia
julia> subset(df, AsTable(:) => ByRow(t -> !all(ismissing, t)))
3×3 DataFrame
 Row │ a b c      
     │ Int64? Int64? Int64? 
─────┼──────────────────────────
   1 │ 2 5 2
   2 │ 3 9 3
   3 │ missing missing 4

julia> @rsubset df !all(ismissing, AsTable(:))
3×3 DataFrame
 Row │ a b c      
     │ Int64? Int64? Int64? 
─────┼──────────────────────────
   1 │ 2 5 2
   2 │ 3 9 3
   3 │ missing missing 4

```

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [January 24, 2023, 4:56pm UTC](https://discourse.julialang.org/t/how-do-i-drop-only-rows-that-are-fully-filled-with-missing-values/93471/4 "2023-01-24T16:56:42Z")

</div>

thanks, this one works.
