I have a pandas.core.series.Series object that looks like this:
6 7
8 9
18 19
35 36
42 43
I want to get a list of 3 randomly chosen numbers from this list. I tried following the advice here and tried
sampled_list = random.sample(df['ID'], 3)
with no luck. Any suggestions?
>Solution :
I think you’re looking for:
df['ID'].sample(3).tolist()
Docs: Series.sample()