Env: Python 3.6, Numpy 1.14.0
a = {ndarray}['中','中']
I need to convert str
type to numpy.string_
.
A single str
can be converted like this: np.string_('中', encoding='utf-8')]
But, how to convert a ndarray with a single statement not loop?
a.astype(np.string_)
will raise a error:
{SystemError} returned a result with an error set