Skip to content

Improve docstring for zfill #20861

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2114,14 +2114,20 @@ def rjust(self, width, fillchar=' '):

def zfill(self, width):
"""
Filling left side of strings in the Series/Index with 0.
Equivalent to :meth:`str.zfill`.
Pad strings in the Series/Index by prepending '0' characters.

Strings in the Series/Index are padded with prepending '0' characeters
(i.e. on the left of the string) to reach a total string length of `width`.
Strings in the Series/Index with length greater than `width` are unchanged.

Note: Differs from :meth:`str.zfill` which has special handling for '+'/'-'
characters in the string.

Parameters
----------
width : int
Minimum width of resulting string; additional characters will be
filled with 0
Minimum length of resulting string; strings with length less than `width`
will be prepended with '0' characters.

Returns
-------
Expand Down