How to select dataframe rows in Julia 1.6?

You misread the error message:

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:

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.

2 Likes