Skip to content
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: Added dict support for pd.set_option #61151

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

arthurlw
Copy link
Contributor

@arthurlw arthurlw commented Mar 20, 2025

@arthurlw arthurlw changed the title Add dict support for set option ENH: Added dict support for pd.set_option Mar 20, 2025
@arthurlw
Copy link
Contributor Author

Hey @rhshadrach, the original issue has not been triaged yet, but I thought it was a worthwhile enhancement to improve code cleanliness. Please let me know what you think!

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Can you also add the deprecation to the whatsnew.

@rhshadrach rhshadrach added Deprecate Functionality to remove in pandas Enhancement API Design labels Mar 22, 2025
@simonjayhawkins
Copy link
Member

Can you also add the deprecation to the whatsnew.

Breaking an established API—especially for a marginal syntactic improvement—comes with a range of both tangible and intangible costs.

Also, we have the PDEP process that should be used for breaking API changes, even small ones?

A user that needs or wants to use a dictionary could simply do...

d = {"a": 1, "b": 2, "c": 3}
flat_list = [elem for pair in d.items() for elem in pair]
print(flat_list)
# ['a', 1, 'b', 2, 'c', 3]

-1

@arthurlw arthurlw requested a review from rhshadrach March 24, 2025 18:27
@rhshadrach
Copy link
Member

Also, we have the PDEP process that should be used for breaking API changes, even small ones?

No - https://pandas.pydata.org/pdeps/0001-purpose-and-guidelines.html

A PDEP (pandas enhancement proposal) is a proposal for a major change in pandas

@rhshadrach
Copy link
Member

Breaking an established API—especially for a marginal syntactic improvement—comes with a range of both tangible and intangible costs.

I find this to be a rough edge in pandas. Is there another package that allows the specification of options/configurations/settings as an iterable of alternating key-value pairs? It seems to me like an odd choice for an API, and one that we can improve by having users supply a data structure that more naturally embodies the key-value relationship.

@simonjayhawkins
Copy link
Member

The -1 is for the deprecation and not the enhancement. A PDEP to cover a deprecation of a single rough edge would be ridiculous.

I posted a question in the issue to further consider the deprecation proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Deprecate Functionality to remove in pandas Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Support dict to pd.set_option for cleaner code
3 participants