# Strange error when passing a DataFrame to pmap

**URL:** https://discourse.julialang.org/t/strange-error-when-passing-a-dataframe-to-pmap/88316
**Category:** General Usage
**Tags:** pmap
**Created:** [October 5, 2022, 11:33pm UTC](https://discourse.julialang.org/t/strange-error-when-passing-a-dataframe-to-pmap/88316 "2022-10-05T23:33:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mb96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mb96/32/45786_2.png) [@mb96](https://discourse.julialang.org/u/mb96)
#### Post date: [October 5, 2022, 11:33pm UTC](https://discourse.julialang.org/t/strange-error-when-passing-a-dataframe-to-pmap/88316/1 "2022-10-05T23:33:17Z")

</div>

Hi there! I am having an error when parallelizing my code with the Distributed library from which I use pmap. The following code might seem a bit strange but it is a (as much as possible) simplification of what I was running.

The main issue is that the code works with map() function but not with pmap() function. I will first provide the code then the error.

```julia
using Distributed
for i in workers()
    rmprocs(i)
end
addprocs(1);
using CSV
@everywhere using DataFrames
@everywhere using Printf

function GenData(x::Array{Float64,1}, hourly_utility::DataFrame)

    @everywhere function utility_gen(util::Int64, hourly_utility::DataFrame)

        for y in collect(2012:2020)

            @printf("utility is %d and year is %d \n", util, y)

        end

    end

    utilities = [195, 3046, 3265, 5416, 5860, 6452, 6455, 6909];
    fit_results_hourly = pmap(u -> utility_gen(u, hourly_utility), 
        utilities)
 
end

hourly_utility = CSV.read("/users/utility_hour_for_Julia.csv", DataFrame);
GenData([2.18, 4.68, 0.01, -0.02, 1.28, 0.58], hourly_utility)

```

If I run it it will raise the following error:

 ![Captura de Pantalla 2022-10-05 a la(s) 19.23.50](https://global.discourse-cdn.com/julialang/original/3X/d/1/d15cf78f727f1404e819b9ada2838ebf1e9ef096.png)

However if I instead use map instead of pmap it will run.  
Can someone please provide me with some help to understand why this is happening?  
Thanks a lot!

---

<div class="post-metadata">

### Author: ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)
#### Post date: [October 6, 2022, 8:10am UTC](https://discourse.julialang.org/t/strange-error-when-passing-a-dataframe-to-pmap/88316/2 "2022-10-06T08:10:06Z")

</div>

The error is related to `InlineStrings` not being in scope.

`InlineStrings` is exported by the CSV package, and that `using` line doesn’t have an `@everywhere` in it. So the other processes don’t have access to `InlineStrings`.  
Changing that to `@everywhere using CSV` should fix this issue.
