# Possible bug in dropmissing!

**URL:** <https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817>\
**Category:** General Usage\
**Created:** [May 31, 2019, 10:53pm UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817 "2019-05-31T22:53:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lewis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lewis/32/5217_2.png) [@lewis](https://discourse.julialang.org/u/lewis)\
**Post date:** [May 31, 2019, 10:53pm UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817/1 "2019-05-31T22:53:15Z")

</div>

I am dropping rows containing missing values from a dataframe.

In 122607 rows, 29 rows contain at least one missing value. I can confirm this 2 ways. First, I wrote a function that counts rows containing 1 or more missing values. Second, using Julia functions, I can do:

```julia
dfnew = dropmissing(df)

```

dfnew has 29 fewer rows than df.

But, dropmissing! reports this error:

```julia
ERROR: MethodError: no method matching deleteat!(::PooledArrays.PooledArray{String,UInt32,1,Array{UInt32,1}}, ::Array{Int64,1})

```

A mystery to me. I guess I won’t use dropmissing!.

---

<div class="post-metadata">

**Author:** ![lewis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lewis/32/5217_2.png) [@lewis](https://discourse.julialang.org/u/lewis)\
**Post date:** [May 31, 2019, 10:56pm UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817/2 "2019-05-31T22:56:16Z")

</div>

Just confirming that:

```julia
df = dropmissing(df)

```

does work.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [June 1, 2019, 12:27am UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817/3 "2019-06-01T00:27:35Z")

</div>

I suspect this is intended - I’ve seen a similar error with `filter!` recently when I load DataFrames without the new `copycols=true` key word argument. iiuc bunch of mutating functions now their errors to prevent unintended manipulation of the underlying vectors. You used to see things [like this](https://github.com/JuliaData/DataFrames.jl/issues/1749), which thankfully doesn’t happen anymore. This is at the expense of needing to explicitly copy columns, which I think is the right design.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [June 1, 2019, 12:30am UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817/4 "2019-06-01T00:30:12Z")

</div>

One thing that might be useful is a more helpful error message in cases like this. It took me a while to figure out what was happening. Not sure how to catch situations like this though.

---

<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:** [June 1, 2019, 12:19pm UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817/5 "2019-06-01T12:19:17Z")

</div>

This is not intended and should work. There is a PR [https://github.com/JuliaComputing/PooledArrays.jl/pull/23](https://github.com/JuliaComputing/PooledArrays.jl/pull/23) that fixes this.

---

<div class="post-metadata">

**Author:** ![lewis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lewis/32/5217_2.png) [@lewis](https://discourse.julialang.org/u/lewis)\
**Post date:** [June 1, 2019, 2:38pm UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817/6 "2019-06-01T14:38:40Z")

</div>

Thanks.

I switched to Julia 1.1.1 and no error. It gets easier/faster to upgrade with each release, but I still dread it.

@macroexpand still doesn’t put the ScikitLearn.jl modules into right name space, but that is an unrelated problem.

---

<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:** [June 4, 2019, 10:56am UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817/7 "2019-06-04T10:56:34Z")

</div>

Update PooledArrays.jl package to the latest version and all will work fine now.

---

<div class="post-metadata">

**Author:** ![lewis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lewis/32/5217_2.png) [@lewis](https://discourse.julialang.org/u/lewis)\
**Post date:** [June 4, 2019, 6:07pm UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817/8 "2019-06-04T18:07:04Z")

</div>

Just downloaded/installed. Will test on Julia 1.1.1.

Thanks again.
