Pandas Sample | pd.DataFrame.sample()

Опубликовано: 19 Август 2020
на канале: Greg Kamradt (Data Indy)
3,958
86

https://dataindependent.com/pandas/pa...
Code: https://github.com/Data-Indepedent/pa...

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)