rafaqz / DimensionalData.jl

Named dimensions and indexing for julia arrays and other data
https://rafaqz.github.io/DimensionalData.jl/stable/
MIT License
262 stars 38 forks source link

Would it be useful to have Not() as a selector? #721

Closed alex-s-gardner closed 1 day ago

alex-s-gardner commented 3 weeks ago

Found myself wanting for a Not() selector today and was wondering if others would find it useful

rafaqz commented 3 weeks ago

Ehhh... We do?

But you need to wrap another selector or Int, not the value directly. Maybe direct could mean not At

Edit: I think the reason I didn't do that is Not Contains might make more sense as a default for intervals, so just spelling it out is better overall

alex-s-gardner commented 3 weeks ago

Of course there is :-)

So I was trying Not("april") instead of Not(At("april") I then searched Not in the documentation but searching such a common word doesn't return anything useful. I then looked at the dcoumition for Selectors:

https://rafaqz.github.io/DimensionalData.jl/dev/api/lookuparrays#DimensionalData.Dimensions.Lookups.Selector

and couldn't find anything there either.

using help with DimensionalData doesn't show the functionality for wrapping a Selector i.e. Not(Selector("april"))

help?> Not()
  InvertedIndex(idx)
  Not(idx)

  Construct an inverted index, selecting all indices not in the passed idx.

  Upon indexing into an array, the InvertedIndex behaves like a 1-dimensional collection of the indices of the array that are not in idx.
  Bounds are checked to ensure that all indices in idx are within the bounds of the array — even though they are skipped. The InvertedIndex
  behaves like a 1-dimensional collection of its inverted indices. If idx spans multiple dimensions (like a multidimensional logical mask
  or CartesianIndex), then the inverted index will similarly span multiple dimensions.

  When indexing into a NamedTuple, the InvertedIndex can wrap either a Symbol, a vector of Symbols, or a tuple of Symbols and selects the
  fields of the NamedTuple that are not in idx.

Looking again this morning I found Not() under Lookups: https://rafaqz.github.io/DimensionalData.jl/dev/selectors#Lookups

rafaqz commented 3 weeks ago

If you saw other places we could document Not, feel free to add them.

felixcremer commented 1 day ago

Isnt this closed?