BUG (regression): Enum
(and subclasses) no longer acceptable parameter type for columns
#54386
Open
2 of 3 tasks
Labels
Bug
Index
Related to the Index class or subclasses
Regression
Functionality that used to work in a prior pandas version
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas. (See below for why I'm confident this issue remains.)
Reproducible Example
Issue Description
When run with
pandas~=2.0
(including2.0.3
):The offending commit appears to be 8020bf1, which looks like it was part of the 2.0.0 development effort. It's hard to tell from #49718 (see also #49348) what the motivation of the additional check was (other than to solve CI issues), but I claim neither familiarity, nor insight, nor competence. I have not run this with pandas-dev/pandas@main, but the relevant check remains unchanged since 2.0.3:
pandas/pandas/core/indexes/base.py
Lines 527 to 530 in 3fe6149
If it remains desirable to allow enums to be used as column headers, I propose the following change (happy to cut a PR with unit tests, if acceptable):
See also #21298 and #22551.
Expected Behavior
When run with
pandas==1.5.3
:Installed Versions
The text was updated successfully, but these errors were encountered: