From DataFrames.jl’s documentation:
https://dataframes.juliadata.org/stable/man/getting_started/
Columns can be directly (i.e. without copying) extracted using
df.col,df."col",df[!, :col]ordf[!, "col"](this rule applies to getting data from a data frame, not writing data to a data frame). The two latter syntaxes are more flexible as they allow passing a variable holding the name of the column, and not only a literal name. Note that column names can be either symbols (written as:col,:var"col"orSymbol("col")) or strings (written as"col"). In the formsdf."col"and:var"col"variable interpolation into a string using$does not work. Columns can also be extracted using an integer index specifying their position.Since
df[!, :col]does not make a copy, changing the elements of the column vector returned by this syntax will affect the values stored in the originaldf. To get a copy of the column usedf[:, :col]: changing the vector returned by this syntax does not changedf.