On Sat, Mar 6, 2021 at 12:57 PM dan_patterson <dan_patter...@outlook.com> wrote:
> The are in np.char > > mystr = np.array(["test first", "test second", "test third"]) > > np.char.title(mystr) > array(['Test First', 'Test Second', 'Test Third'], dtype='<U11') > I mentioned those in my email, but they are far less convenient to use than class methods, nor do they relate well to how built-in strings are used in Python. That is why other projects have started using accessor methods and why Python removed all the separate string functions in Python 3. The functions in np.char are also limited in their capabilities, and fairly poorly documented in my opinion. Some of those limitations are impossible to overcome, for example they inherently can never support operators, addition or multiplication, or slicing like Python strings can, while an accessor could. However, putting them as top-level methods for ndarray would pollute the methods too much. That is why I am suggesting numpy do the same thing that pandas, xarray, etc. are doing and putting those as methods under a 'str' attribute for ndarrays rather than as separate functions.
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion