-
Notifications
You must be signed in to change notification settings - Fork 119
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
enh: let Enum
take arguments, allow it in construction
#1541
Comments
@MarcoGorelli I can take this one on |
awesome! please do let us know if anything trips you up |
@MarcoGorelli let me know if the following question is a bit out of scope and I should focus only on adding some extra code to patch In the following code snippet what should the expected dtype of column dfpd = pd.DataFrame({"a": ["a", "b"]}, dtype="category")
df = nw.from_native(dfpd).select(nw.col("a").cast(nw.Enum(["a", "b"]))) The ambiguous portion is that internally Given the above consideration, would it be best to: a. Converting to an I have a working codebase for option B and can open a PR if you want to take a look for some more fine-grained discussion. |
thanks for looking at this so closely - i'm gonna have to think about this one, not 100% sure atm 😄 |
Just chiming in here as I'd find this features super useful. My main use case would be having a narwhals-land alternative to df = nw.from_native(dfpd).select(nw.col("a").cast(nw.Enum(["a", "b"]))) would work. I don't have a preference between options b. and c., but I'd if we could simply cast pandas series without manually creating a new one via |
We should be able to do
and have it create a Series with dtype Categorical and categories 'a', 'b', 'c', 'd'
The text was updated successfully, but these errors were encountered: