Length of each string in a NumPy array

后端 未结 4 917
一整个雨季
一整个雨季 2020-12-17 15:34

Is there any builtin operation in NumPy that returns the length of each string in an array?

I don\'t think any of the NumPy string operations does that, is this corr

4条回答
  •  不知归路
    2020-12-17 16:23

    Using str_len from Numpy:

    sizes = np.char.str_len(arr)
    

    str_len documentation: https://numpy.org/devdocs/reference/generated/numpy.char.str_len.html

提交回复
热议问题