perfect, thank you!

On Friday, May 16, 2014 11:28:46 AM UTC-4, John Myles White wrote:
>
> This is a result of the weird precedence of &. Try this: 
>
> (df[:A] .== 1) & (df[:B] .== 1) 
>
>  — John 
>
> On May 16, 2014, at 8:25 AM, Jason Solack <jays...@gmail.com <javascript:>> 
> wrote: 
>
> > Hello all 
> > 
> > I'm trying to index a dataframe in the folowing manner: 
> > 
> > df = DataFrame(A = round(rand(1000) * 10), B = round(rand(1000) * 10)) 
> > df[:C] = 0 
> > df[(df[:A] .== 1 & df[:B] .== 1),: C] = 1 
> > 
> > 
> > I get an error "ERROR: no method &(Int64, DataArray{Float64, 1}) 
> > 
> > if i index like this, it works but i won't be able to do "ors" 
> > 
> > df[(df[:A] .== 1 .* df[:B] .== 1),: C] = 1 
> > 
> > is there another way of going about this? 
> > 
> > Thank you, 
> > 
> > Jason 
>
>

Reply via email to