ENH: Implement core/strings/wrap method by jeffreystarr · Pull Request #6999 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation3 Commits14 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

jeffreystarr

This patch implements the str.wrap function within core/strings.

Example:

    >>> s = pd.Series(['line to be wrapped', 'another line to be wrapped'])
    >>> s.str.wrap(12)
    0             line to be\nwrapped
    1    another line\nto be\nwrapped

This is a cleaned branch; the original is at #6705.

@jeffreystarr

@jeffreystarr

This patch implements the str_wrap function within core/strings. The implementation follows the behavior of R's stringr library. When a string is 'wrap'ped, the return value will be a paragraph with lines of max(word length, width) length.

@jeffreystarr

…R's stringr library defaults and semantics (width being exclusive).

@jeffreystarr

Expanded docstring with description of major optional parameters and added an example.

@jeffreystarr

@jeffreystarr

@jeffreystarr

@jeffreystarr

… (thus matching textwrap module)

@jeffreystarr

@jeffreystarr

@jeffreystarr

@jeffreystarr

…an the direct str_wrap form.

@jeffreystarr

@jeffreystarr

@jreback

@jorisvandenbossche

yep, looking good! (I think all comments were already adressed)

@jreback