-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: Disallow sets as index and columns argument in DataFrame constructor #47231
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, but I think there is still not consensus on if this should go through deprecation first: #47215 (comment)
pandas/_typing.py
Outdated
@@ -115,7 +114,7 @@ | |||
Ordered = Optional[bool] | |||
JSONSerializable = Optional[Union[PythonScalar, List, Dict]] | |||
Frequency = Union[str, "DateOffset"] | |||
Axes = Collection[Any] | |||
Axes = Union[AnyArrayLike, List, Dict, range, Sequence[str]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why specifically Sequence[str] and not Sequence[Hashable]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed Dict
and Sequence[str]
in the next commit. Sequence[Hashable]
will match a string, and that is not a valid value for index
or columns
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
@jreback have merged with latest master. You were last to review - suggesting using |
hmm https://github.com/pandas-dev/pandas/runs/7271930917?check_suite_focus=true i thinksomething changed on master for types...... |
Yes, there was a change made that made the We have to avoid using Next commit addresses that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be +0 for a deprecation, but I think this is also okay that this is mentioned in the Other API changes
section. Off to @jreback
thanks @Dr-Irv lgtm. |
pandas/tests/frame/test_constructors.py
methodtest_columns_indexes_raise_on_sets
doc/source/whatsnew/v1.5.0.rst
file if fixing a bug or adding a new feature.Note: This also allowed some typing changes removing some
#type: ignore
statements