Series.sample

Return a random sample of items from an axis of object.

danfo.Series.sample(num) [source]

Parameters

Type

Description

Default

num

Int

number of random samples to obtain

5

Returns: Series

Example

const dfd = require("danfojs-node")
let data1 = [1, 2, 3, 4, 5, 620, 30, 40, 39, 89, 78]
let sf1 = new dfd.Series(data1)
sf1.sample(5).print()
Output
Output
╔═══╤══════════════════════╗
║ │ 0
╟───┼──────────────────────╢
439
╟───┼──────────────────────╢
789
╟───┼──────────────────────╢
078
╟───┼──────────────────────╢
1620
╟───┼──────────────────────╢
54
╚═══╧══════════════════════╝