-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to check if an array contains categorical values? #332
Comments
It is not safe unfortunately. Your question is in general hard that we need to resolve somehow - maybe @nalimilan has some more recent thoughts what would be best to do, as we are asked about it often. |
Most of the time The most correct solution is to use |
What about a |
Well it would be equivalent to exporting |
What about exporting both? Would it make sense? Sometimes user code,
specially in data science scripts end users just need to call a clean
function to branch on behavior. I see the type for dispatch useful for a
different audience. People who master Julia already.
…On Tue, Mar 2, 2021, 07:54 Milan Bouchet-Valat ***@***.***> wrote:
Well it would be equivalent to exporting CatArrOrSub, but with the
drawback that it cannot be used for dispatch.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZQW3OOSSG4BIHH5IIKNA3TBS7WFANCNFSM4YNXTIVA>
.
|
Why would |
Maybe it is a matter of taste. Maybe it is because most beginners aren't even familiar with the existence of the operator |
Why would changing |
Say people are relying on the type for complex multiple dispatch and the
type suddenly changes into a Union type or a subtype of another Array type.
The code in the user side may get affected, isn't that correct?
iscategorical will always be a function no matter what, and the behavior
will be documented and guaranteed. I'm just sharing what I feel is more
stable. For example, I'm reporting this issue now because my code was
broken when I assumed v isa CategoricalArray was a safe check.
…On Tue, Mar 2, 2021, 10:18 Milan Bouchet-Valat ***@***.***> wrote:
Why would changing CatArrOrSub be more breaking than changing
iscategorical?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZQW3KAWRTKRMUBBWBS77LTBTQRLANCNFSM4YNXTIVA>
.
|
Yes that could create dispatch issues, but |
This issue, in case anyone hasn't noticed, is essentially a duplicate of #234, which is also open. |
Closing as duplicate |
I used to write
v isa CategoricalArray
in user code to change the behavior and noticed that in the latest release of the package a view of aCategoricalArray
is no longer aCategoricalArray
. Is it safe to doeltype(v) <: CategoricalValue
to check the condition in code? Perhaps a user function could be added to the api with this purpose?The text was updated successfully, but these errors were encountered: