lundi 9 novembre 2020

Pynthon | random.randint | invalid type promontion | when np.hstack or np.append

I'm trying to add to a empty np array the result of a np.random.randint. To add the result, I have tried with np.append, np.hstack, but in any case always I take a "invalid type promotion". Thanks for the help.

for i in range(10):
    print("Choose random row from a 2D array")
    randomRow = np.random.randint(0,6,size=2)
    a2 = np.hstack((a2, a1[randomRow[0],:]))



Aucun commentaire:

Enregistrer un commentaire