Powered By GitBook
Series.mod
Return Modulo of series and other, element-wise (binary operator mod).
danfo.Series.mod(other, options) [source]
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
Node
1
const dfd = require("danfojs-node")
2
3
let data1 = [2, 30, 4, 5]
4
let data2 = [1.1, 2.2, 3.3, 2.4]
5
let sf1 = new dfd.Series(data1)
6
let sf2 = new dfd.Series(data2)
7
sf1.mod(sf2).print()
Copied!
Output
1
╔═══╤══════════════════════╗
2
║ │ 0 ║
3
╟───┼──────────────────────╢
4
║ 0 │ 0.8999999761581421 ║
5
╟───┼──────────────────────╢
6
║ 1 │ 1.3999993801116943 ║
7
╟───┼──────────────────────╢
8
║ 2 │ 0.7000000476837158 ║
9
╟───┼──────────────────────╢
10
║ 3 │ 0.19999980926513672 ║
11
╚═══╧══════════════════════╝
Copied!
Modulo with a value
Node
1
const dfd = require("danfojs-node")
2
3
let data1 = [1, 2, 3, 4, 5]
4
let sf1 = new dfd.Series(data1)
5
6
sf1.mod(2).print()
Copied!
Output
1
╔═══╤══════════════════════╗
2
║ │ 0 ║
3
╟───┼──────────────────────╢
4
║ 0 │ 1 ║
5
╟───┼──────────────────────╢
6
║ 1 │ 0 ║
7
╟───┼──────────────────────╢
8
║ 2 │ 1 ║
9
╟───┼──────────────────────╢
10
║ 3 │ 0 ║
11
╟───┼──────────────────────╢
12
║ 4 │ 1 ║
13
╚═══╧══════════════════════╝
Copied!
Last modified 24d ago
Copy link