I am struggling with an issue regarding CSV files and Python. How would I generate a random number in a csv file row, based of a condition in that row.
Essentially, if the value in the first column is 'A' I want a random number between (1 and 5). If the value is B I want a random number between (2 and 6) and if the value is C, and random number between (3 and 7).
Letter | Color | Random Number |
---|---|---|
A | Green | |
C | Red | |
B | Red | |
B | Green | |
C | Blue |
Thanks in advance
The only thing I have found was creating a new random number dataframe. But I need to create a random number for an existing df.
Aucun commentaire:
Enregistrer un commentaire