Skip to content

GH1203 Pass a dict to setter for DataFrame.loc/iloc #1204

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
merged 2 commits into from
Apr 28, 2025

Conversation

loicdiridollou
Copy link
Member

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.

I would like to see if we could not just use a generic dict here. We would not want to allow something like df.loc[0] =df.loc[0] = {"X": pd.Series([1,2,3])} Maybe Mapping[Hashable, Scalar | NAType | NaTType) would be a better type.

@loicdiridollou
Copy link
Member Author

Indeed that will be a bit more restrictive and avoid weird inputs.

@loicdiridollou loicdiridollou requested a review from Dr-Irv April 28, 2025 00:35
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.

@Dr-Irv Dr-Irv merged commit ec745ff into pandas-dev:main Apr 28, 2025
13 checks passed
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.

__setitem__ should accept a dictionary
2 participants