# Pmap over data frame

**URL:** <https://discourse.julialang.org/t/pmap-over-data-frame/25432>\
**Category:** Julia at Scale\
**Created:** [June 19, 2019, 1:29am UTC](https://discourse.julialang.org/t/pmap-over-data-frame/25432 "2019-06-19T01:29:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abx](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@abx](https://discourse.julialang.org/u/abx)\
**Post date:** [June 19, 2019, 1:29am UTC](https://discourse.julialang.org/t/pmap-over-data-frame/25432/1 "2019-06-19T01:29:03Z")

</div>

I am trying to pmap a function over a DataFrame, probably I am missing something really obvious.  
As per the example below, I would each DataFrameRow to be an element of the pmap, and each column value of the DataFrameRow to be set as an argument of the called function DoWork

```julia
df = DataFrame(A=[1,2,3], B=["a","b","c"])

function DoWork(a, b)
    println("$a $b") #-> this will print 1 a, 2 b, 3 c
end

pmap(DoWork, df) #argh!

```

The DataFrame is populated from a database and I can’t change the way it is provided to me - I need to convert it.I tried various things like convert to a list of vector or a matrix with little luck. Is there any better way to do this?  
Thanks

---

<div class="post-metadata">

**Author:** ![abx](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@abx](https://discourse.julialang.org/u/abx)\
**Post date:** [June 20, 2019, 6:18pm UTC](https://discourse.julialang.org/t/pmap-over-data-frame/25432/2 "2019-06-20T18:18:13Z")

</div>

This is the best I could come up with 🙂

```julia
df = DataFrame(A=[1,2,3], B=["a","b","c"])
function DoWork(test)
    a = test[1]
    b = test[2]

    println("$a $b")
end

myvec=[]

for row in eachrow(df)
  push!(myvec, permutedims(Vector(row))) 
end

pmap(x-> DoWork(x), myvec)

```

Thanks for any better advice you can give me!
