# Multiple conditions on a dataframe

**URL:** <https://discourse.julialang.org/t/multiple-conditions-on-a-dataframe/4368>\
**Category:** General Usage\
**Created:** [June 20, 2017, 1:25pm UTC](https://discourse.julialang.org/t/multiple-conditions-on-a-dataframe/4368 "2017-06-20T13:25:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IljaK91](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iljak91/32/44301_2.png) [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Post date:** [June 20, 2017, 1:25pm UTC](https://discourse.julialang.org/t/multiple-conditions-on-a-dataframe/4368/1 "2017-06-20T13:25:17Z")

</div>

In my code, I want to get some entry from my dataframe and apply multiple conditions (here: country-year). My code is:

` df[(df[:year] .== year) & (df[:country] .== country_name),:crisisJST][1,1]`

So I specify a year and a country and want to get the value that I have in column crisisJST. This went through in 0.5.2 without problems, but it throws now an error:

```julia
MethodError: &(::DataArrays.DataArray{Bool,1}, ::DataArrays.DataArray{Bool,1}) is ambiguous. Candidates:
  &(a::DataArrays.DataArray{Bool,N} where N, b::Union{AbstractArray{Bool,N} where N, Bool}) in DataArrays at C:\Users\Ilja\.julia\v0.6\DataArrays\src\operators.jl:390
  &(b::Union{AbstractArray{Bool,N} where N, Bool}, a::DataArrays.DataArray{Bool,N} where N) in DataArrays at C:\Users\Ilja\.julia\v0.6\DataArrays\src\operators.jl:390
Possible fix, define
  &(::DataArrays.DataArray{Bool,N} where N, ::DataArrays.DataArray{Bool,N} where N)

```

I am a bit clueless however about the meaning of this. Can anybody help me with it?

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [June 20, 2017, 1:51pm UTC](https://discourse.julialang.org/t/multiple-conditions-on-a-dataframe/4368/2 "2017-06-20T13:51:12Z")

</div>

You should use `.&`.

---

<div class="post-metadata">

**Author:** ![IljaK91](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iljak91/32/44301_2.png) [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Post date:** [June 20, 2017, 2:00pm UTC](https://discourse.julialang.org/t/multiple-conditions-on-a-dataframe/4368/3 "2017-06-20T14:00:41Z")

</div>

Thank you! 🙂
