Skip to content
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

feat(rust, python): Expr.cat.get_categories expression #9869

Merged
merged 1 commit into from
Jul 14, 2023
Merged

Conversation

ritchie46
Copy link
Member

Get the underlying categories of a Categorical data type.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Jul 14, 2023
@magarick
Copy link
Contributor

Can't we just call it "categories" or "levels". The whole "get" thing just feels unnecessary.

@ritchie46
Copy link
Member Author

Can't we just call it "categories" or "levels". The whole "get" thing just feels unnecessary.

No, we are explicit in our API. So we must answer the question what do you want to do with the "categories"? If we named it "categories", we close the door for a future "set_categories" or "insert_categories" etc.

@magarick
Copy link
Contributor

Can't we just call it "categories" or "levels". The whole "get" thing just feels unnecessary.

No, we are explicit in our API. So we must answer the question what do you want to do with the "categories"? If we named it "categories", we close the door for a future "set_categories" or "insert_categories" etc.

I don't see how it closes the door to anything. It's a minor issue but i see "categories" or "levels" more as an attribute that you're accessing, not a function that's doing anything. Perfectly explicit in that case, and a function that actually does something, that has a verb in front. I guess everyone has their own internal view of what's clear and obvious and right though, 🤷

@ritchie46
Copy link
Member Author

Perfectly explicit in that case, and a function that actually does something, that has a verb in front. I guess everyone has their own internal view of what's clear and obvious and right though, shrug

But it isn't an attribute. It is a function. You are right, people have their own preferences, that's why I hammer on this, as we have different developers working on this, but we should have a unified code and API style.

The goals for the API are listed here: #6120 (comment)

@ritchie46 ritchie46 merged commit bae44a0 into main Jul 14, 2023
@ritchie46 ritchie46 deleted the cats branch July 14, 2023 08:51
c-peters pushed a commit to c-peters/polars that referenced this pull request Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants