samedi 4 janvier 2020

Numpy random won't work (Beginners Question) [closed]

haven't used python in a while and for some reason i cant assign a random value to a float. I want to add to my csv 10 rows with random value between 0.1 and 0.3 on second column:

import numpy as np [#this line gets first error of "you are not using numpy"]

for x in range(10):

with open('question.csv','a') as fd:
    cell_rand = random.uniform(0.1, 0.3) [#this line gets error of 'undefined name random']
    row_id = x
    fd.write(row_id, cell_rand, None)

Would appreciate your help on this one!




Aucun commentaire:

Enregistrer un commentaire