# Multi-threading with DataFrames

**URL:** <https://discourse.julialang.org/t/multi-threading-with-dataframes/101859>\
**Category:** General Usage\
**Tags:** multithreading, dataframes\
**Created:** [July 20, 2023, 10:16pm UTC](https://discourse.julialang.org/t/multi-threading-with-dataframes/101859 "2023-07-20T22:16:35Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Post date:** [December 24, 2023, 3:36pm UTC](https://discourse.julialang.org/t/multi-threading-with-dataframes/101859/34 "2023-12-24T15:36:02Z")

</div>

a small step forward(?). If you illustrate the typical cases of formulas used, perhaps something can be added

I realize that the idea and above all the implementation is really naive and, I fear, not very efficient.  
But let’s play with Julia’s expressions and while waiting for ideas for improvement, I’ll give you a small step forward(?).

If you illustrate the typical cases of formulas used, perhaps something can be added

```julia

julia> function str2func(str)
           lff=findfirst('(', str)
           op=df[str[1:lff-1]]
           if !occursin('(',str[lff+1:end])
               par=split(str[lff+1:end-1],',')
               tp=tryparse.(Int,par)
               opxy=(x,y)->(b->(c->op(c,b)))(x)(y)
               if all(isnothing,tp)
                   return opxy
               else
                   n=only(filter(!isnothing,tp))
                   return z->opxy(n,z)
               end
           else
               par=split(str[lff+1:end-1],"),")
               par[1:end-1] .*=')'
               return (x...)->op([str2func(p)(var) for (p,var) in zip(par,x)]...)
           end
       end
str2func (generic function with 1 method)

julia> str= "+(*(3,x),*(2,y))"
"+(*(3,x),*(2,y))"

julia> str2func(str)(3,3)
15

julia> str= "*(+(3,x),+(2,y))"
"*(+(3,x),+(2,y))"

julia> str2func(str)(2,3)
25

julia> str= "+(3,x)"
"+(3,x)"

julia> str2func(str)(-3)
0

```

I posted an updated version of the script [here](https://discourse.julialang.org/t/convert-string-to-function-name/1547/30)

---

_[View the full topic](https://discourse.julialang.org/t/multi-threading-with-dataframes/101859)._
