-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Align Series.str.zfill() with str.zfill() #21874
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
|
||
if not is_integer(width): | ||
msg = 'width must be of integer type, not {0}' | ||
raise TypeError(msg.format(type(width).__name__)) |
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.
Add test for this validation.
@atulagrwl : Good start! Need a |
Added the validation test in last commit and added whatsnew entry too. |
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.
pls add
- whatsnew note, other api changes, need a sub-section showing the previous and the new behavior
- check docs in text.rst to see if anything needs updating, if not pls add small example of usage there.
@@ -2220,27 +2220,31 @@ def test_center_ljust_rjust_fillchar(self): | |||
result = values.str.rjust(5, fillchar=1) | |||
|
|||
def test_zfill(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.
the issue mentions also affecting rjust
, pad
, center
, can you add / update tests as needed for those as well.
@@ -84,6 +84,7 @@ Other Enhancements | |||
- :meth:`Series.nlargest`, :meth:`Series.nsmallest`, :meth:`DataFrame.nlargest`, and :meth:`DataFrame.nsmallest` now accept the value ``"all"`` for the ``keep`` argument. This keeps all ties for the nth largest/smallest value (:issue:`16818`) | |||
- :class:`IntervalIndex` has gained the :meth:`~IntervalIndex.set_closed` method to change the existing ``closed`` value (:issue:`21670`) | |||
- :func:`~DataFrame.to_csv` and :func:`~DataFrame.to_json` now support ``compression='infer'`` to infer compression based on filename (:issue:`15008`) | |||
- :func:`Series.str.zfill()` now matches with standard string library zfill (:issue:`20868`) |
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.
see comments, make this a sub section in api breaking (yes its a bug fix, but an unexpected one)
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.
Also, parentheses not needed at the end of zfill
in the :func: ref.
can you rebase |
closing as stale. if you'd like to continue, pls ping. |
git diff upstream/master -u -- "*.py" | flake8 --diff
Using standard library
zfill
method directly to handle specific characters issue