Skip to content

fix: #1212 allow Series.name in pivot_table #1216

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

Merged

Conversation

cmp0xff
Copy link
Contributor

@cmp0xff cmp0xff commented May 16, 2025

@cmp0xff cmp0xff force-pushed the hotfix/cmp0xff/1212-series-name-in-pivot-table branch from ca9c44e to 682aa19 Compare May 16, 2025 08:01
@cmp0xff
Copy link
Contributor Author

cmp0xff commented May 16, 2025

It turns out that in pandas.core.reshape.pivot, there has already been an implementation using Hashable instead of str. I decide to deviate from the discussion in #1212, and follow the practice there, in order to stay more generic.

Comment on lines 54 to 58
PivotTableIndexTypes: TypeAlias = Label | Sequence[HashableT1] | Series | Grouper | None
PivotTableColumnsTypes: TypeAlias = (
Label | Sequence[HashableT2] | Series | Grouper | None
)
PivotTableValuesTypes: TypeAlias = Label | Sequence[HashableT3] | None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you make these private by preceding the names with an underscore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By doing so I would be importing private names, which is disfavoured in PLC2701. Nevertheless 4aa89d8

Copy link
Collaborator

Choose a reason for hiding this comment

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

within stub files, that is OK

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

thanks @cmp0xff

@Dr-Irv Dr-Irv merged commit 366caf9 into pandas-dev:main May 16, 2025
13 checks passed
@cmp0xff cmp0xff deleted the hotfix/cmp0xff/1212-series-name-in-pivot-table branch May 16, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pivot_table does not accept Series.name as index, columns or value
2 participants