I have a 2d numpy array of ints called M. I would like to convert all the ints to strings returning a 2d numpy array of the same shape. How can you do that?
I tried map(str, M) but that doesn't work as it converts the individual rows into strings.
You can use astype to cast the array to particular type
m = np.array([[1,2,3], [4,5,6]])
m = m.astype(str)
m
array([['1', '2', '3'],
['4', '5', '6']], dtype='<U21')