I want to replace the elements of an array (which contains numbers) with strings.For example I want "1" to be replaced with "a", I want "2" to be replaced with "b", and I want "3" to be replaced with "c". I did the following and didn't work for me. Can anyone suggest a way to resolve the issue?
test = np.where(test==1, "a", test)
test = np.where(test==2, "b", test)
test = np.where(test==3, "c", test)
numpy.ndarrayscannot contain mixed types, unless you plan to store plainobjects (defeating most of the reasons to usenumpy) or numbers as strings.testarraydtypeat each step.