DataFrame.mul
Get Multiplication of dataframe and other, element-wise (binary operator mul).
danfo.DataFrame.mul(other, option)
Parameters
Type
Description
Default
other
DataFrame, Series, Array or Scalar
Object to multiply with
option
Object
{
axis: 0 for row, 1 for column.
inplace: Boolean indicating whether to perform the operation inplace or not. Defaults to false
}
{ axis: 1, inplace: false }
Examples
Multiplication of scalar with 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.mul(2)
df_new.print()╔════════════╤═══════════════════╤═══════════════════╗
║ │ Col1 │ Col2 ║
╟────────────┼───────────────────┼───────────────────╢
║ 0 │ 20 │ 46 ║
╟────────────┼───────────────────┼───────────────────╢
║ 1 │ 90 │ 40 ║
╟────────────┼───────────────────┼───────────────────╢
║ 2 │ 112 │ 20 ║
╟────────────┼───────────────────┼───────────────────╢
║ 3 │ 20 │ 48 ║
╚════════════╧═══════════════════╧═══════════════════╝Multiplication of Series with DataFrame along axis 0
Multiplication of DataFrame with another DataFrame
Multiplication of Array with DataFrame along axis 0
Multiplication works inplace
Last updated