# CSV, DataFrames problems with threads

**URL:** <https://discourse.julialang.org/t/csv-dataframes-problems-with-threads/31318>\
**Category:** General Usage\
**Created:** [November 20, 2019, 2:35pm UTC](https://discourse.julialang.org/t/csv-dataframes-problems-with-threads/31318 "2019-11-20T14:35:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [November 20, 2019, 2:35pm UTC](https://discourse.julialang.org/t/csv-dataframes-problems-with-threads/31318/1 "2019-11-20T14:35:33Z")

</div>

Today I encountered an odd problem:

```julia
using CSV, DataFrames
dt = DataFrame(a = rand(10000), b = rand(10000), c = rand(10000))
CSV.write("test.csv", dt)

df = CSV.File("test.csv") |> DataFrame!
df[(ismissing.(df.a)) .| (ismissing.(df.b)) .| (ismissing.(df.c)), :]

```

The code above works with 1 thread but with 4 threads (on Julia 1.3) it gives

**MethodError: no method matching LazyArrays.LazyArrayStyle()**

I thought that I share my finding here, as I don’t know whether this is a problem with CSV, DataFrames or threading.  
The used versions are:

- OS: Win 10
- Julia 1.3-rc{4,5}
- CSV v0.5.18
- DataFrames v0.19.4

---

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [November 21, 2019, 2:13pm UTC](https://discourse.julialang.org/t/csv-dataframes-problems-with-threads/31318/2 "2019-11-21T14:13:31Z")

</div>

xref: [https://github.com/JuliaData/CSV.jl/issues/536](https://github.com/JuliaData/CSV.jl/issues/536)

---

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [November 21, 2019, 2:30pm UTC](https://discourse.julialang.org/t/csv-dataframes-problems-with-threads/31318/3 "2019-11-21T14:30:44Z")

</div>

> [@Rudi79](#):
>
> I thought that I share my finding here, as I don’t know whether this is a problem with CSV, DataFrames or threading.

The offending line in CSV is [https://github.com/JuliaData/CSV.jl/blob/b85a3ce8fcb1d0c9611b07d591f58985d6e9ea42/src/CSV.jl#L470](https://github.com/JuliaData/CSV.jl/blob/b85a3ce8fcb1d0c9611b07d591f58985d6e9ea42/src/CSV.jl#L470) (use of `LazyArrays.ApplyArray` if threaded) and I guess it’s an issue with LazyArrays (which bit me yesterday but in a different context). So maybe it’s worth opening an issue with LazyArrays?
