The chararray class exists for backwards compatibility with Numarray,
it is not recommended for new development. Starting from numpy 1.4, if
one needs arrays of strings, it is recommended to use arrays of dtype
object_, string_ or unicode_, and use the free functions in the
numpy.char module for fast vectorized string operations.
IIUC,可以使用^{} 指定数据类型为长度
unicode
的1
。你知道吗在official docs中
因此,如果您需要使用
isalpha()
这样的方法,请使用np.char
模块,如下所示,而不再使用np.chararray
类:或者
相关问题 更多 >
编程相关推荐