DataFrame.sample
Return a random sample of rows from DataFrame.
Parameters
Type
Description
Default
Sample a DataFrame randomly
const dfd = require("danfojs-node")
async function sample_data() {
let data = {
Name: ["Apples", "Mango", "Banana", "Pear"],
Count: [21, 5, 30, 10],
Price: [200, 300, 40, 250],
};
let df = new dfd.DataFrame(data);
let s_df = await df.sample(2);
s_df.print();
}
sample_data()Sample a DataFrame randomly with seed
Last updated