Series.mod

Returns Modulo of series and other, element-wise (binary operator mod).

danfo.Series.mod(other, options)

ParametersTypeDescriptionDefault

other

Series|int|float

values

options

Object

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

{

inplace: false

}

Return: Series

Example

Modulus with values of another series

const dfd = require("danfojs-node")

let data1 = [2, 30, 4, 5]
let data2 = [1.1, 2.2, 3.3, 2.4]
let sf1 = new dfd.Series(data1)
let sf2 = new dfd.Series(data2)
sf1.mod(sf2).print()
╔═══╤═════════════════════╗
║ 0 │ 0.8999999999999999  ║
╟───┼─────────────────────╢
║ 1 │ 1.3999999999999977  ║
╟───┼─────────────────────╢
║ 2 │ 0.7000000000000002  ║
╟───┼─────────────────────╢
║ 3 │ 0.20000000000000018 ║
╚═══╧═════════════════════╝

Modulo with a value

const dfd = require("danfojs-node")

let data1 = [1, 2, 3, 4, 5]
let sf1 = new dfd.Series(data1)

sf1.mod(2).print()
╔═══╤═══╗
║ 0 │ 1 ║
╟───┼───╢
║ 1 │ 0 ║
╟───┼───╢
║ 2 │ 1 ║
╟───┼───╢
║ 3 │ 0 ║
╟───┼───╢
║ 4 │ 1 ║
╚═══╧═══╝

Last updated