How to choose 3 random numbers from a pandas.series object?
Question:
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?
Answers:
sampled_list = random.sample(list(df['ID']), 3)
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?
sampled_list = random.sample(list(df['ID']), 3)