What is replacement for Not column selection in DataFrames (inverted index) in DataFrames v0.20.0?

I was making extensive of the Not function for column selection in DataFrames. However this is deprecated in v0.20.0 and I haven’t yet found how to do the equivalent in the latest documentation.

Indeed the DataFrames documentation still shows this usage:

A Not selector (from the InvertedIndices package) can be used to select all columns excluding a specific subset:

df[!, Not(:x1)]

It is Not deprecated. :wink: Get it?

But really, it’s not.

1 Like

For numeric column index exclusion, it looks like I can replace

select(df, Not([2,3])


select(df, vcat(1, collect(4:size(df, 2))))

The old form is much nicer and the documentation is still wrong.

Now I need to figure out the syntax for excluding an array of symbols!

The notice of changes for DataFrames v0.20.0 states specifically that Not is no longer available. If I try to use it from the InvertedIndices package, it still fails.

Not still works with v0.19.x.

Too add on my previous post: InvertedIndices.jl is exactly what DataFrames.jl uses. It is re-exported by the package.

Not sure what troubles you are having but I’m on v0.20.2 and have no dep warning or anything like that. Examples like you posted work fine. Perhaps try to update?

Oops, looks like my DataFrames got set to v0.18.4 somehow and I had just rebuilt my environment.

I’ll force the upgrade and try again. Sorry if I’ve raised a false alarm.

I stand corrected. After a forced upgrade to DataFrames v0.20.2, the original syntax works nicely.

Sorry about raising a false alarm.