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

Enum type output for cut #13038

Closed
s-banach opened this issue Dec 13, 2023 · 3 comments · Fixed by #15843
Closed

Enum type output for cut #13038

s-banach opened this issue Dec 13, 2023 · 3 comments · Fixed by #15843
Assignees
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature

Comments

@s-banach
Copy link
Contributor

Description

(Not sure if Enum types are merged yet, I know they've been worked on.)
I'm just hoping that the dtype for x.cut() could be an Enum that includes all specified bins, even bins that don't occur in x.

@s-banach s-banach added the enhancement New feature or an improvement of an existing feature label Dec 13, 2023
@cmdlineluser
Copy link
Contributor

(Just for reference: Enum was added in #11822)

@stinodego stinodego added the accepted Ready for implementation label Dec 15, 2023
@stinodego
Copy link
Member

Makes sense 👍

@s-banach
Copy link
Contributor Author

Currently the order of the categories coming out of cut also seems to be broken:

import polars as pl
s = pl.Series([0.7, 0.3, 0.9, 0.2, 0.6])
bins = [0.2, 0.4, 0.6, 0.8]
print(s.cut(bins).sort())
shape: (5,)
Series: '' [cat]
[
	"(0.6, 0.8]"
	"(0.2, 0.4]"
	"(0.8, inf]"
	"(-inf, 0.2]"
	"(0.4, 0.6]"
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants