Skip to content

Commit

Permalink
add note on views / copies in getting started -- JuliaData#2224
Browse files Browse the repository at this point in the history
  • Loading branch information
nickeubank committed May 5, 2020
1 parent 8e033a9 commit 9346ff0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/src/man/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,21 @@ Equivalently, the `in` function can be called with a single argument to create
a function object that tests whether each value belongs to the subset
(partial application of `in`): `df[in([1, 5, 601]).(df.A), :]`.

!!! note

While data frames support indexing syntax that is very similar to
matrices, subsetting from a `DataFrame` will return a copy, not
a view.

The only subsetting situations where data frames will **not** return a copy are:

- when a `!` is placed in the first indexing position (`df[!,:A]`, or `df[!, [:A, :B]]`),
- when using `.` notation (`df.A`),
- when a single row is selected using a single integer (`df[1, :A]`), or
- when the `@view` macro is used (`@view df[1:3, :A]`).

More details on copies, views, and references can be found [here.](https://juliadata.github.io/DataFrames.jl/stable/lib/indexing/#getindex-and-view-1)

#### Column selection using `select` and `select!`, `transform` and `transform!`

You can also use the [`select`](@ref) and [`select!`](@ref) functions to select,
Expand Down

0 comments on commit 9346ff0

Please sign in to comment.