dimanche 24 octobre 2021

How do I pass a randomized variable as an argument to a function? [closed]

I am writing a code that assigns a variable to a random value from a pandas dataframe by using the choice function from the "random" module: random.choice(df).

I am trying to pass this variable as an argument to a function; however, the code throws a disambiguation error, and I'm not sure how to solve it. I'm assuming it's not taking the unique, random value and instead passing every possible value from the series. How do I maintain the variable being random and passing the random value as a unique argument to the function? I have tried using the lambda anonymous function, which didn't work; and I've also tried a "try-except:pass" block, which also didn't work. Is there a way to possibly utilize threading?




Aucun commentaire:

Enregistrer un commentaire