Rishavv
Rishavv

Reputation: 293

Generate random numbers from a particular column

I have a dataset in this form

item_id  EAN   Price
3434     232    34
3233     412    28

There are totally 54344 datapoints.

I want to random print 40 values from EAN. I tried some techniques like

df=pd.read_csv('item_desc.csv')
print(df['EAN'].random.rand(40))

but it doesn't worked. Can someone suggest me the code

Upvotes: 0

Views: 54

Answers (1)

anon01
anon01

Reputation: 11161

you can use sample:

df.sample(n=40)

Upvotes: 2

Related Questions