When I call random.sample(arr,length)
an error returns random_sample() takes at most 1 positional argument (2 given).  After some Googling I found out I'm calling Numpy's random sample function when I want to call the sample function of the random module.  I've tried importing numpy under a different name, which doesn't fix the problem.  I need Numpy for the rest of the program, though.
Any thoughts? Thanks
Sounds like you have something like
import random
from numpy import *
and random is getting clobbered by the numpy import.  If you want to keep the import * then you'll need to rename random:
import random as rnd    # or whatever name you like
from numpy import *
Alternatively, and probably better, is to import numpy as a module instead of just yanking it all into your module's namespace:
import random
import numpy as np      # or leave as numpy, or whatever name you like
                        This shouldn't happen. Check your code for bad imports like from numpy import *.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With