Reputation: 3887
New to Julia here! I am trying to replicate what I read in the DataFrames documentation:
df = DataFrames.DataFrame(A = 1:2:1000, B = repeat(1:10, inner=50), C = 1:500)
df[df.A .> 500, :]
However I can't get over this error:
LoadError: type DataFrame has no field A while loading In[282], in expression starting on line 2
I am using Julia 0.5 and the DataFrames package is the 0.8.5
How do I use this feature?
Upvotes: 0
Views: 108
Reputation: 69819
The feature you have problem with is a syntax df.A
. It was introduced after DataFrames.jl was migrated to support Julia 1.0, since Julia 1.0 allows for custom implementations of getproperty
method.
The syntax df.A
is equivalent to df[:A]
and it works correctly under current release 0.14.1 of DataFrames.jl.
Upvotes: 2
Reputation: 3887
Not sure if I am on a wrong version, however I had to tweak my code to the following:
df[df[:A] .> 500, :]
this would filter the DataFrame by rows having A>500
Upvotes: 0