diff --git a/docs/src/lib/indexing.md b/docs/src/lib/indexing.md index ed2ca488d..36bd1fd2b 100644 --- a/docs/src/lib/indexing.md +++ b/docs/src/lib/indexing.md @@ -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()` diff --git a/test/indexing.jl b/test/indexing.jl index 7660a9601..c7dd69d11 100644 --- a/test/indexing.jl +++ b/test/indexing.jl @@ -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()