Answers for "how to get a sample from a the rows of a dataframe in python"

1

pandas sample rows

# To sample a fixed number of rows
df.sample(n = 100)

# To sample a fraction of rows
df.sample(frac = 0.5)
Posted by: Guest on April-04-2021

Code answers related to "how to get a sample from a the rows of a dataframe in python"

Python Answers by Framework

Browse Popular Code Answers by Language