how convert integers in a matrix to their corresponding alphabets in python -
i trying convert matrix of integers corresponding alphabet in python. 1=a,b=2 etc have far xlabels matrix integers.
a = np.zeros((15,15)) x in xrange(0,15): y in xrange(0,15): a[x, y] = chr(ord('a')-1 + xlabels[0, 0]) print(a)
but error saying
valueerror: not convert string float: n
replace:
a = np.zeros((15,15))
with:
a = np.zeros((15,15), dtype=str)
Comments
Post a Comment