Missings.jl
Missings.jl copied to clipboard
Add `isless` variant where `missing` is smallest
The definitions to make missing
smallest would be
isless2(::Missing, ::Missing) = false
isless2(::Missing, ::Any) = true
isless2(::Any, ::Missing) = false
isless2(x, y) = isless(x, y)
@nalimilan - the question is what should be the name of this function (as usual this is the hardest part).
Also a question is if Missings.jl should export it (I think it is OK to export it if we find a good name)
islessmissingsmallest
or islessmissingfirst
would be explicit though a bit long...
This is my fear. Let us ask on Slack.
let's start by removing isless
, since it is the default value
missingassmallest
missingissmallest
We could also say missingisless
since this function really does this: consider that missing
is less than all other values.
missingless
? (without s
in the middle)
it sounds like a play on words (or is it? I like it).
missingless
could be read as no missing
You guys obviously know way more than me with regards of design and philosophy of these packages, but I thought of this operation as sort
acting in somehow in combination with skipmissing
. I don't know if that's the right approach an what consequences you have from this, but something like sort(df, :A, rev = true, skipmissing = true)
was the operation I was hoping to have.
The approach we are discussing is more general and would allow you to sort any collection, e.g. a vector in exactly the same way.
Any objections to missingisless
?
BTW, since the main use case is to do sort(x, lt=missingisless, rev=true)
, we could directly provide a function which reverses the order. But I don't have a good name for that (missingisnotgreater
?)
missingisnotgreater
feels unclear.
missingisless
seems OK.