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.

 — John

On Feb 28, 2014, at 6:36 PM, Jason Solack <jaysol...@gmail.com> wrote:

> 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,
> 
> Jason

Reply via email to