-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC/TST: Clarify Series.str.get supports passing hashable label #47918
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
NO! #47911 (comment) |
doc/source/whatsnew/v1.5.0.rst
Outdated
@@ -279,6 +279,7 @@ Other enhancements | |||
- :class:`Series` reducers (e.g. ``min``, ``max``, ``sum``, ``mean``) will now successfully operate when the dtype is numeric and ``numeric_only=True`` is provided; previously this would raise a ``NotImplementedError`` (:issue:`47500`) | |||
- :meth:`RangeIndex.union` now can return a :class:`RangeIndex` instead of a :class:`Int64Index` if the resulting values are equally spaced (:issue:`47557`, :issue:`43885`) | |||
- :meth:`DataFrame.compare` now accepts an argument ``result_names`` to allow the user to specify the result's names of both left and right DataFrame which are being compared. This is by default ``'self'`` and ``'other'`` (:issue:`44354`) | |||
- :meth:`Series.str.get` now raises when ``i`` is not a integer (:issue:`47911`) |
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.
Could you specify the error?
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.
Small comment, otherwise Lgtm
i is positional, e.g. strings should raise
edit: pre commit is failing, you can check this locally
i is only positional in the documentation... it's definitely not strictly positional in current functionality. |
I am starting to agree with @BeRT2me, I don't think we can change this outright. I think the fact that I would be +1 to keep supporting this (although there's cognizant dissonance with |
Do you want to deprecate or add this to the documentation? |
How In my opinion, mirroring how Not forgetting to update the documentation to match would be nice as well... |
I think if we have a list of dictionaries like
we could construct a |
Should |
I would save that for another issue to discuss |
Appears some doc checks are failing |
Honestly, I don't know what's going wrong from the Traceback of the failed check. |
Might want to merge in the main branch into this PR. I believe there was some doc failures that were fixed recently. |
pandas/tests/strings/test_strings.py
Outdated
def test_get_with_dict_label(): | ||
# GH47911 | ||
s = Series( | ||
[{"name": "Hello", "value": "World"}, {"name": "Goodbye", "value": "Planet"}] |
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.
Could you also add an element where "name"
does not exist in the dictionary?
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.
LGTM. @phofl if you have any comments, especially opinions on supporting this.
Thanks @xr-chen |
…as-dev#47918) * gh 47911 * pre-commit issue * add test and fix doc * modified comment * pep 8 * add more elements
…as-dev#47918) * gh 47911 * pre-commit issue * add test and fix doc * modified comment * pep 8 * add more elements
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.