-
Notifications
You must be signed in to change notification settings - Fork 126
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
Add Series.categories/1 #465
Conversation
This function is useful to retrieve only the categories from a categorical series. The resultant series is of ":string" dtype.
@doc """ | ||
Return a series with the category names of a categorical series. | ||
|
||
Each category has the index equal to its position. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a note that no order is guaranteed for the categories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. For what I could understand, the ordering is defined by the order the elements appear in the series. But this is not clear.
Internally there is a flag to the the ordering to lexical: https://pola-rs.github.io/polars/polars_core/datatypes/categorical/struct.CategoricalChunked.html#method.set_lexical_sorted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is defined like that but mostly as an implementation accident and not a guarantee? Providing fewer guarantees doesn’t hurt anyway :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Note added 👍
…nt-release Prepare rustler_bigint release
This function is useful to retrieve only the categories from a categorical series.
The resultant series is of ":string" dtype.