Select "n" number of rows randomly from a Pandas data frame


(Chamin Nalinda) #1

Hi al,
What is the efficient way of selecting ‘n’ number of rows randomly from a given data frame. There should not be any duplicate rows.
Please do assist.
Thanks


(Chamin Nalinda) #2

I found the answer by myself here[1]
[1] https://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.DataFrame.sample.html