Skip to content

Latest commit

 

History

History
87 lines (73 loc) · 2.95 KB

series.div.md

File metadata and controls

87 lines (73 loc) · 2.95 KB
description
Return Floating division of series and other, element-wise (binary operator truediv).

Series.div

danfo.Series.div(other, options)

Parameters Type Description Default
other Series|int| values
options Object inplace: Boolean indicating whether to perform the operation inplace or not. Defaults to false

{

inplace: false

}

Return: Series

Example

divide with values of another series

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

const dfd = require("danfojs-node")

let data1 = [30, 40, 3, 5]
let data2 = [1, 2, 3, 4]
let sf1 = new dfd.Series(data1)
let sf2 = new dfd.Series(data2)
sf1.div(sf2).print()

{% endtab %} {% endtabs %}

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

╔═══╤══════════════════════╗
║   │ 0                    ║
╟───┼──────────────────────╢
║ 0 │ 30                   ║
╟───┼──────────────────────╢
║ 1 │ 20                   ║
╟───┼──────────────────────╢
║ 2 │ 1                    ║
╟───┼──────────────────────╢
║ 3 │ 1.25                 ║
╚═══╧══════════════════════╝

{% endtab %} {% endtabs %}

divide 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.div(2).print()

{% endtab %} {% endtabs %}

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

╔═══╤══════════════════════╗
║   │ 0                    ║
╟───┼──────────────────────╢
║ 0 │ 0.5                  ║
╟───┼──────────────────────╢
║ 1 │ 1                    ║
╟───┼──────────────────────╢
║ 2 │ 1.5                  ║
╟───┼──────────────────────╢
║ 3 │ 2                    ║
╟───┼──────────────────────╢
║ 4 │ 2.5                  ║
╚═══╧══════════════════════╝

{% endtab %} {% endtabs %}