Skip to content
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

DOC: fix PR02 errors in docstring for pandas.Series.str.wrap #57321

Merged
merged 8 commits into from
Feb 13, 2024
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.Series.dt.ceil\
pandas.Series.dt.month_name\
pandas.Series.dt.day_name\
pandas.Series.str.wrap\
pandas.Series.cat.rename_categories\
pandas.Series.cat.reorder_categories\
pandas.Series.cat.add_categories\
Expand Down
21 changes: 18 additions & 3 deletions pandas/core/strings/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2210,12 +2210,20 @@ def removesuffix(self, suffix: str):
return self._wrap_result(result)

@forbid_nonstring_types(["bytes"])
def wrap(self, width: int, **kwargs):
def wrap(
self,
width: int,
expand_tabs: bool = True,
replace_whitespace: bool = True,
drop_whitespace: bool = True,
break_long_words: bool = True,
break_on_hyphens: bool = True,
jordan-d-murphy marked this conversation as resolved.
Show resolved Hide resolved
):
r"""
Wrap strings in Series/Index at specified line width.

This method has the same keyword parameters and defaults as
:class:`textwrap.TextWrapper`.
:class:`textwrap.TextWrapper`.

Parameters
----------
Expand Down Expand Up @@ -2265,7 +2273,14 @@ def wrap(self, width: int, **kwargs):
1 another line\nto be\nwrapped
dtype: object
"""
result = self._data.array._str_wrap(width, **kwargs)
result = self._data.array._str_wrap(
width=width,
expand_tabs=expand_tabs,
replace_whitespace=replace_whitespace,
drop_whitespace=drop_whitespace,
break_long_words=break_long_words,
break_on_hyphens=break_on_hyphens,
)
return self._wrap_result(result)

@forbid_nonstring_types(["bytes"])
Expand Down
Loading