Is there a specific reason why I need to define myop
in the snippet below?
Otherwise things do not work for me.
using DataFrames
dff=DataFrame(a=trues(4),b=trues(4),c=2*ones(4))
cnms = [:a, :b]
#fails
mapreduce(x->dff[!,x], .& , cnms)
#works
myop(x,y) = x .& y
mapreduce(x->dff[!,x], myop , cnms)
1 Like
I think this is a parsing thing. .&
isn’t a function.
I’ve wanted this before as well, an easy way to refer to the broadcasted version of a function via, for example, Broadcast(fun)
.
also, note that you can use eachcol
here instead of iterating through the names.
Hm. Ok.
regarding eachcol
: in my actual use case I only iterate over a subset of all columns.