DataFrame.sub
Get Subtraction of dataframe and other, element-wise (binary operator sub).
Parameters
Type
Description
Default
Examples
Subtraction of scalar from DataFrame along default axis 1
const dfd = require("danfojs-node")
let data = {
"Col1": [10, 45, 56, 10],
"Col2": [23, 20, 10, 24]
}
let df = new dfd.DataFrame(data)
let df_new = df.sub(2)
df_new.print()╔════════════╤═══════════════════╤═══════════════════╗
║ │ Col1 │ Col2 ║
╟────────────┼───────────────────┼───────────────────╢
║ 0 │ 8 │ 21 ║
╟────────────┼───────────────────┼───────────────────╢
║ 1 │ 43 │ 18 ║
╟────────────┼───────────────────┼───────────────────╢
║ 2 │ 54 │ 8 ║
╟────────────┼───────────────────┼───────────────────╢
║ 3 │ 8 │ 22 ║
╚════════════╧═══════════════════╧═══════════════════╝Subtraction of Series from DataFrame along axis 0
Subtraction of DataFrame from another DataFrame
Subtraction of Array from DataFrame along axis 0
Subtraction works inplace
Last updated