# How to select dataframe rows in Julia 1.6?

**URL:** https://discourse.julialang.org/t/how-to-select-dataframe-rows-in-julia-1-6/60696
**Category:** New to Julia
**Tags:** question
**Created:** [May 7, 2021, 7:39am UTC](https://discourse.julialang.org/t/how-to-select-dataframe-rows-in-julia-1-6/60696 "2021-05-07T07:39:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)
#### Post date: [May 7, 2021, 7:39am UTC](https://discourse.julialang.org/t/how-to-select-dataframe-rows-in-julia-1-6/60696/1 "2021-05-07T07:39:08Z")

</div>

Hello,  
I have been selecting the rows of a dataframe with a column `Hit` matching a parameter stored in the variable `h` with `qry = df[df[:Hit] .== h, :]` but now I have switched to Hulia 1.6 and I am getting this error:

```julia
julia> qry = df[df[:Hit] .== h, :]
ERROR: ArgumentError: syntax df[column] is not supported use df[!, column] instead
Stacktrace:
 [1] getindex(#unused#::DataFrame, #unused#::Symbol)
   @ DataFrames ~/.julia/packages/DataFrames/pf2RS/src/abstractdataframe/abstractdataframe.jl:2157
 [2] top-level scope
   @ none:1

```

I tried with:

```julia
julia> qry = df[!, Hit .== h, :]
ERROR: UndefVarError: Hit not defined
Stacktrace:
 [1] top-level scope
   @ none:1

julia> qry = df[!, :Hit .== h, :]
ERROR: MethodError: no method matching getindex(::DataFrame, ::typeof(!), ::Bool, ::Colon)
Closest candidates are:
  getindex(::DataFrame, ::typeof(!), ::Union{Colon, Regex, AbstractVector{T} where T, All, Between, Cols, InvertedIndex}) at /home/gigiux/.julia/packages/DataFrames/pf2RS/src/dataframe/dataframe.jl:587
  getindex(::DataFrame, ::typeof(!), ::Union{AbstractString, Symbol}) at /home/gigiux/.julia/packages/DataFrames/pf2RS/src/dataframe/dataframe.jl:507
  getindex(::DataFrame, ::typeof(!), ::Union{Signed, Unsigned}) at /home/gigiux/.julia/packages/DataFrames/pf2RS/src/dataframe/dataframe.jl:499
  ...
Stacktrace:
 [1] top-level scope
   @ none:1
julia> qry = df[!, :Hit .== h]
ERROR: MethodError: no method matching getindex(::DataFrame, ::typeof(!), ::Bool)
Closest candidates are:
  getindex(::DataFrame, ::typeof(!), ::Union{Colon, Regex, AbstractVector{T} where T, All, Between, Cols, InvertedIndex}) at /home/gigiux/.julia/packages/DataFrames/pf2RS/src/dataframe/dataframe.jl:587
  getindex(::DataFrame, ::typeof(!), ::Union{AbstractString, Symbol}) at /home/gigiux/.julia/packages/DataFrames/pf2RS/src/dataframe/dataframe.jl:507
  getindex(::DataFrame, ::typeof(!), ::Union{Signed, Unsigned}) at /home/gigiux/.julia/packages/DataFrames/pf2RS/src/dataframe/dataframe.jl:499
  ...
Stacktrace:
 [1] top-level scope
   @ none:1

```

What is the new syntax for this task?  
Thanks

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [May 7, 2021, 7:48am UTC](https://discourse.julialang.org/t/how-to-select-dataframe-rows-in-julia-1-6/60696/2 "2021-05-07T07:48:57Z")

</div>

You misread the error message:

```julia
ERROR: ArgumentError: syntax df[column] is not supported use df[!, column] instead

```

means you can’t do `df[:Hit]` anymore, you should do `df[!, :Hit]` (or alternatively `df.Hit`).

So you want:

```julia
df[df.Hit .== h, :]

```

Note that this has nothing to do with the Julia version, this is DataFrames behaviour and only depends on the version of the DataFrames package you use. The `df[:col]` syntax has been deprecated a long time ago, and the current DataFrames version is 1.1.0 so now is a good time to update any old cold you might have given that the API is now considered stable since the DataFrames 1.0 release.

Finally, you can also use `filter` and `subset` to select rows in a DataFrame.
