Skip to content

Commit

Permalink
consider one more corner case
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamins committed Mar 29, 2023
1 parent 74547b3 commit eaaac0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/src/lib/indexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ The following values are a valid column index:
* a `Not` expression (see
[InvertedIndices.jl](https://github.com/JuliaData/InvertedIndices.jl));
`Not(idx)` selects all indices not in the passed `idx`;
when passed as column selector `Not(idx...)` is equivalent to `Not(Cols(idx...))`.
when passed as column selector `Not(idx...)` is equivalent to
`Not([idx...])` if all indices are integers or to
`Not(Cols(idx...))` otherwise.
* a `Cols` expression (see
[DataAPI.jl](https://github.com/JuliaData/DataAPI.jl)); `Cols(idxs...)`
selects the union of the selections in `idxs`; in particular `Cols()`
Expand Down
3 changes: 3 additions & 0 deletions test/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ using Test, DataFrames, Unicode, Random
end

@test df[!, Not(1, 2)] == DataFrame(c=7:9)
@test_throws ArgumentError df[!, Not(1, 1, 2)]
@test df[!, Not(:b, 1)] == DataFrame(c=7:9)
@test df[!, Not(:b, :b, 1)] == DataFrame(c=7:9)
@test df[!, Not("c", :a)] == DataFrame(b=4:6)
@test df[!, Not("c", "c", :a)] == DataFrame(b=4:6)
@test df[!, Not(:b, "c", :a)] == DataFrame()
@test df[!, Not([1, 2], :b)] == DataFrame(c=7:9)
@test df[!, Not([:c, :a], :b)] == DataFrame()
Expand Down

0 comments on commit eaaac0a

Please sign in to comment.