I made a PR for another new method `np.char.slice_` here:
https://github.com/numpy/numpy/pull/20694

Here is an excerpt of the PR message:

There are numerous examples of string slicing being a fairly requested
feature:

- https://stackoverflow.com/q/70547027/2988730
- https://stackoverflow.com/q/39042214/2988730
- https://stackoverflow.com/q/40976714/2988730
- https://stackoverflow.com/q/64981711/2988730
- https://stackoverflow.com/q/31387047/2988730
- https://stackoverflow.com/q/69856133/2988730
- ... I stopped searching around here

Given the existence of the `char` module, there is no reason not to include
a basic slicing operation that can work cheaper than making views and
copies of a string, or switching to pandas for this one feature. This PR
introduces such a function. It's written entirely in python, and does its
absolute best not to make a copy of any data.

The original inspiration for this is my answer to the first question in the
list above. I've added a couple of features since then, like the ability to
have a meaningful non-unit step and the ability to set the length of
non-unit-step chunks.

Please let me know your thoughts about the value of something like this.

Regards,

- Joe
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to