I am trying to insert a string into a integer based matrix in numpy matrix. I am wondering if their is a way to change the datatype of the index that I want to store the string in?
I have tried to use the .astype() function but had no luck in doing so. This is what I have tried to do
c = np.array([0])
c.resize((3,3))
c.fill(0)
c.astype(str)
c.itemset(2, 0, 'S')
This is what I am trying to have my output look like:
OutPut:
[[0 0 S]
[0 0 0]
[0 0 0]]