📌  相关文章
📜  在数据框中获取随机行 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:00.745000             🧑  作者: Mango

代码示例1
df = pandas.DataFrame(pandas.np.random.random(100))

# Randomly sample 70% of your dataframe
df_percent = df.sample(frac=0.7)

# Randomly sample 7 elements from your dataframe
df_elements = df.sample(n=7)