Converting a numpy.ndarray to string
Use ndarray.tostring
-
my_string_numpy_array.tostring()
In [176]: my_string_numpy_array.tostring()
Out[176]: 'My name is Aman Raparia'
The right answer for numpy is Divakar's ndarray.tostring
.
An alternative is to use chr
on each array element and join together (for a non numpy array for example):
>>> ''.join([chr(e) for e in my_string_numpy_array])
'My name is Aman Raparia'