Skip to content

fix: Pass/Retrieve empty categories from nw.Enum#3284

Merged
MarcoGorelli merged 1 commit intonarwhals-dev:mainfrom
camriddell:fix-empty-enum
Nov 7, 2025
Merged

fix: Pass/Retrieve empty categories from nw.Enum#3284
MarcoGorelli merged 1 commit intonarwhals-dev:mainfrom
camriddell:fix-empty-enum

Conversation

@camriddell
Copy link
Copy Markdown
Member

What type of PR is this? (check all applicable)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes
    • This was expected, but untested behavior.

If you have comments or can explain your changes, please do so below

>>> import narwhals as nw
>>> dtype = nw.Enum([])
>>> dtype.categories # old behavior: TypeError: Internal structure of 'Enum' is invalid.
()                   # new behavior: returns correctly

Copy link
Copy Markdown
Member

@dangotbanned dangotbanned left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @camriddell!

praise be narwhal

@MarcoGorelli MarcoGorelli changed the title fix: Pass/Reteive empty categories from nw.Enum fix: Pass/Retrieve empty categories from nw.Enum Nov 7, 2025
@MarcoGorelli
Copy link
Copy Markdown
Member

nice, thanks!

@MarcoGorelli MarcoGorelli merged commit 3e0aa0f into narwhals-dev:main Nov 7, 2025
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nw.Enum([]) raises when evaluating __{repr,hash}__

3 participants