[julia-users] DataFrames, select column with variable

2014-02-28 Thread Jason Solack
Hello all, I'm trying to select a column from a DataFrame using a variable... something like this df = DataFrame(A=[1:10], B=[11:20]) when i do this: df [ : 2] i select column B if i do this: t = 2 df [ : t] i get an error Error Key not found :t what am i missing?? Thank you in advance

Re: [julia-users] DataFrames, select column with variable

2014-02-28 Thread John Myles White
Hi Jason, I’m surprised that df[: 2] works: that seems almost like a bug. To get column B, either of the following should work on a new copy of DataFrames: df[2] df[:B] If you have a slightly older copy of DataFrames (like you’d get for Julia 0.2), this works df[2] df[“B”] Hope that helps.