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

Extend python Enum interop to DataFrame/Series/Enum construction #18018

Closed
deanm0000 opened this issue Aug 2, 2024 · 0 comments · Fixed by #20999
Closed

Extend python Enum interop to DataFrame/Series/Enum construction #18018

deanm0000 opened this issue Aug 2, 2024 · 0 comments · Fixed by #20999
Assignees
Labels
enhancement New feature or an improvement of an existing feature

Comments

@deanm0000
Copy link
Collaborator

Description

In furtherance of #16858

It seems that if we have

from enum import auto, StrEnum
import polars as pl

class Color(StrEnum):
    red = auto()
    green = auto()
    blue = auto()

that the following should return a column that is an Enum type

df = pl.DataFrame({'color': [Color.red, Color.green, Color.blue]})

should return the color column as a pl.Enum in the same way that pl.lit was made to.

Similarly, we should be able to do pl.Enum(Color)

@deanm0000 deanm0000 added the enhancement New feature or an improvement of an existing feature label Aug 2, 2024
@deanm0000 deanm0000 self-assigned this Aug 2, 2024
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
Projects
None yet
1 participant