Series.apply

Invoke a function on each value in a Series.

danfo.series.apply(callable, options)

Parameters
Type
Description
Default

callable

Function

Function (can be anonymous) to apply

options

Object

inplace: Boolean indicating whether to perform the operation inplace or not. Defaults to false

{

inplace: false

}

Returns:

**** return Series


Example

const dfd = require("danfojs-node")

let sf = new dfd.Series([1, 2, 3, 4, 5, 6, 7, 8])

let apply_func = (x) => {
    return x + x
}
sf.apply(apply_func).print()
╔═══╤════╗
║ 0 │ 2  ║
╟───┼────╢
║ 1 │ 4  ║
╟───┼────╢
║ 2 │ 6  ║
╟───┼────╢
║ 3 │ 8  ║
╟───┼────╢
║ 4 │ 10 ║
╟───┼────╢
║ 5 │ 12 ║
╟───┼────╢
║ 6 │ 14 ║
╟───┼────╢
║ 7 │ 16 ║
╚═══╧════╝

Last updated