-
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
Fix constructors and conversion between categorical arrays #63
Conversation
Codecov Report
@@ Coverage Diff @@
## master #63 +/- ##
==========================================
+ Coverage 91.3% 91.97% +0.67%
==========================================
Files 9 9
Lines 506 511 +5
==========================================
+ Hits 462 470 +8
+ Misses 44 41 -3
Continue to review full report at Codecov.
|
Looks great Milan! Thanks for your work here. I've also learned several things, like how your commit messages auto-populate the fields of the pull request. I had noticed that the first line of commit messages will auto populate the title of a PR, but I had no idea the extended body of a commit would auto populate the first message of a PR. That's a big incentive for putting more effort into commit messages. Is the plan to merge this and tag a new version, and then I'll add modify JuliaData/DataTables.jl#30 to remove the |
0c57e8c
to
ebbf66b
Compare
Previously only the conversions between CategoricalArrays and between NullableCategoricalArrays were using specific methods. This means conversion between these two types did not preserve levels, ordering or reference type. Use broader signatures to cover this, and throw an error if nulls are found when converting to CategoricalArray. Make tests more systematic to cover all possible combinations; remove old tests which are now redundant. Also drop the guaranty that constructors always return a copy. This is inconsistent with e.g. Array(), would have made the code more complex, and would trap users who thought the behavior was the same as for convert(). By the way, this an inconsistency in the default value for the 'ordered' argument to constructors, and fix docstrings: the default is now always to preserve the corresponding property of the input.
This was not visible before since the convert() method for arrays explicitly called ordered!() even if it should not have been necessary.
ebbf66b
to
ec3aa80
Compare
3 similar comments
Actually, it doesn't when there are several commits. But copy-pasting the commit message is pretty effective too. :-)
Yes, see JuliaLang/METADATA.jl#8417. |
Previously only the conversions between CategoricalArrays and between
NullableCategoricalArrays were using specific methods. This means conversion
between these two types did not preserve levels, ordering or reference type.
Use broader signatures to cover this, and throw an error if nulls are found
when converting to CategoricalArray. Make tests more systematic to cover
all possible combinations; remove old tests which are now redundant.
Also drop the guaranty that constructors always return a copy. This is
inconsistent with e.g. Array(), would have made the code more complex,
and would trap users who thought the behavior was the same as for convert().
By the way, this an inconsistency in the default value for the 'ordered'
argument to constructors, and fix docstrings: the default is now always
to preserve the corresponding property of the input.
Fixes #62.