The following selects an entire column in a DataFrame:
select(df,:x)
But how do I select the second row of x, say?
The following selects an entire column in a DataFrame:
select(df,:x)
But how do I select the second row of x, say?
select(df, :x)
. That doesn’t select the column, it makes a new DataFrame
with only one column :x
. i.e. it doesn’t return the array df.x
.
For the vector you want
df.x # doesn't copy the column
df[!, :x] # doesn't copy the column
df[:, :x] # copies the column
For the second element you want
df[2, :x]
df.x[2]