Published on
· Data Independent

Pandas Sample | pd.DataFrame.sample()

This post is auto-generated from a public YouTube video for personal study notes. It is not an endorsement. The transcript is machine-derived and may contain errors; refer to the original video for accuracy.

About this video

Pandas Sample is used when you need to pull random rows or columns from a DataFrame.

Why would you ever want random rows? Say you're running a data science model, and you want to test a subset of data. If you're not using train test split, you can use pd.sample() to pull a small section of rows.

pandas.DataFrame(n=number_of_samples, axis=rows_or_columns)

Loading transcript…