Given that i have a dataset as below:
dict = {
"No": list(range(1,9)),
"Pro": [0.6703557312252965, 0.20395256916996046, 0.0782608695652174, 0.03241106719367589, 0.009486166007905139, 0.0031620553359683794, 0.0015810276679841897, 0.0007905138339920949]
}
dt = pd.DataFrame(dict)
And i need to generate a number from "NO
" column based on "Pro
" column:
noList = dt["No"].tolist()
pro = dt["Pro"].tolist()
print("NoList", noList, " Pro: ", pro)
randomPolypNo = np.random.choice(noList, pro)
But, it complains with:
TypeError: 'float' object cannot be interpreted as an integer
What is the problem?
Aucun commentaire:
Enregistrer un commentaire