We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Right now, if you want to create Polars enum from a StrEnum you're required to first list convert it:
StrEnum
import enum class PythonEnum(enum.StrEnum): A = "A" B = "B" C = "C" e = pl.Enum(list(PythonEnum)) df = pl.DataFrame({"Col 1": ["A", "B", "C"]}, schema={"Col 1": e})
While easy enough, I don't see any reason why direct creation of Polars Enums from Python enums shouldn't be supported:
import enum class PythonEnum(enum.StrEnum): A = "A" B = "B" C = "C" e = pl.Enum(PythonEnum) df = pl.DataFrame({"Col 1": ["A", "B", "C"]}, schema={"Col 1": e})
The text was updated successfully, but these errors were encountered:
pl.Enum
why not go one step further and use the python enum directly? (should be possble?) 😄 This works for exmpale using python str / int / float
str
int
float
pl.DataFrame( {"a": [1], "b": [1], "c": [1]}, schema={ "a": pl.String, "b": str, # <<<<< "c": float, # <<<<< }, strict=False, )
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Description
Right now, if you want to create Polars enum from a
StrEnum
you're required to first list convert it:While easy enough, I don't see any reason why direct creation of Polars Enums from Python enums shouldn't be supported:
The text was updated successfully, but these errors were encountered: