-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffCompatpandas objects compatability with Numpy or Python functionspandas objects compatability with Numpy or Python functionsEnhancement
Description
This seems to be related to this issue and this merge. But currently DataFrame.sample does not allow Generator objects for random_state.
Rationale
As far as I can tell, the convention for numpy 1.21 random sampling, in their documentation is to create Generators using numpy.random.default_rng, so creating BitGenerators directly seems a little awkward.
Fix
This is a quick fix though because the generator has field to access the bit generator
from numpy.random import default_rng
rng = default_rng()
bit_generator = rng.bit_generator
Metadata
Metadata
Assignees
Labels
AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffCompatpandas objects compatability with Numpy or Python functionspandas objects compatability with Numpy or Python functionsEnhancement