位数被截了
首先有个array a
a= np.array(list_a, dtype=bytes)
a.dtype
Out: dtype('S23')
23就是list_a里最长的字符串
然后有个array b
b = np.array(list_b, dtype=bytes)
b.dtype
Out: dtype('S31')
同理,31就是list_b里最长的字符串
现在需要把b插入a,或直接替换a中的列,会导致b的字符串位数变少,直接截成23位
因此,可以在读取a的时候把位数设到确保够大
string:
a = np.array(list_a, dtype='S100')
unicode:
a = np.array(list_a, dtype='U100')
可能会导致内存占用增加,但没找到更好的解决方式
dype相关使用可以参考https://www.jb51.net/article/175212.htm