-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
COMPAT: followup to #17491 #17503
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
COMPAT: followup to #17491 #17503
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17503 +/- ##
==========================================
- Coverage 91.18% 91.16% -0.02%
==========================================
Files 163 163
Lines 49543 49545 +2
==========================================
- Hits 45177 45170 -7
- Misses 4366 4375 +9
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17503 +/- ##
==========================================
- Coverage 91.18% 91.16% -0.02%
==========================================
Files 163 163
Lines 49543 49545 +2
==========================================
- Hits 45177 45169 -8
- Misses 4366 4376 +10
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.21.0.txt
Outdated
@@ -193,16 +193,16 @@ the target. Now, a ``ValueError`` will be raised when such an input is passed in | |||
Iteration of Series/Index will now return python scalars | |||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |||
|
|||
Previously, when using certain iteration methods for a ``Series`` with dtype ``int`` or ``float``, you would receive a ``numpy`` scalar, e.g. a ``np.int64``, rather than a python ``int``. Issue (:issue:`10904`) corrected this for ``Series.tolist()`` and ``list(Series)``. This change makes all iteration methods consistent, in particular, for ``__iter__()`` and ``.map()``; note that this only affect int/float dtypes. (:issue:`13236`, :issue:`13258`, :issue:`14216`). | |||
Previously, when using certain iteration methods for a ``Series`` with dtype ``int`` or ``float``, you would receive a ``numpy`` scalar, e.g. a ``np.int64``, rather than a python ``int``. Issue (:issue:`10904`) corrected this for ``Series.tolist()`` and ``list(Series)``. This change makes all iteration methods consistent, in particular, for ``__iter__()`` and ``.map()``; note that this only affects int/float dtypes. (:issue:`13236`, :issue:`13258`, :issue:`14216`). |
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.
python --> Python (same thing in the doc-strings that you changed)
pandas/core/base.py
Outdated
@@ -892,18 +892,27 @@ def argmin(self, axis=None): | |||
|
|||
def tolist(self): | |||
""" | |||
return a list of the values; box to scalars | |||
return a list of the values. These are each a scalar type, which is |
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.
Capitalize that first sentence (same with __iter__
doc-string)
@@ -1102,3 +1136,40 @@ def test_categorial_datetimelike(self, method): | |||
|
|||
result = method(i)[0] | |||
assert isinstance(result, Timestamp) | |||
|
|||
def test_iter_box(self): |
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.
Is this just a new test for coverage purposes or related to any of the issues you addressed?
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.
a moved test
""" iterate like Categorical """ | ||
return self._data.__iter__() | ||
def tolist(self): | ||
return self._data.tolist() |
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 don't think this is needed? Base Index
already defines this as self._values.tolist()
, and _values
and _data
is both a Categorical ?
No description provided.