Skip to content

Latest commit

 

History

History
81 lines (67 loc) · 2.28 KB

series.mod.md

File metadata and controls

81 lines (67 loc) · 2.28 KB
description
Returns Modulo of series and other, element-wise (binary operator mod).

Series.mod

danfo.Series.mod(other, options)

Parameters Type Description Default
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

{% tabs %} {% tab title="Node" %}

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()

{% endtab %} {% endtabs %}

{% tabs %} {% tab title="Output" %}

╔═══╤═════════════════════╗
║ 00.8999999999999999  ║
╟───┼─────────────────────╢
║ 11.3999999999999977  ║
╟───┼─────────────────────╢
║ 20.7000000000000002  ║
╟───┼─────────────────────╢
║ 30.20000000000000018 ║
╚═══╧═════════════════════╝

{% endtab %} {% endtabs %}

Modulo with a value

{% tabs %} {% tab title="Node" %}

const dfd = require("danfojs-node")

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

sf1.mod(2).print()

{% endtab %} {% endtabs %}

{% tabs %} {% tab title="Output" %}

╔═══╤═══╗
║ 01 ║
╟───┼───╢
║ 10 ║
╟───┼───╢
║ 21 ║
╟───┼───╢
║ 30 ║
╟───┼───╢
║ 41 ║
╚═══╧═══╝

{% endtab %} {% endtabs %}