I have the solution.... I have to use the numpy array dtype parameter which says:
dtype : data-type, optional The desired data-type for the array. If not given, then the type will be determined as the minimum type required to hold the objects in the sequence. This argument can only be used to ‘upcast’ the array. For downcasting, use the .astype(t) method.
C = [(np.random.randint(-10,10),np.random.randint(-10,10)) for i in range(3)] C = np.array(C,dtype='float32') C[0,0] = 1.654 print(C[0,0])
So clearly, C is of dtype int because this is sufficient to store the random integer values. If I now want to set an element of C to a float value I have to change the dtype of C.