Danfo.js
Getting Started
API Reference
Contributing Guide
Github
Search…
Danfo.js Documentation
Getting Started
API reference
General Functions
Input/Output
Series
Dataframe
Creating a DataFrame
DataFrame.sortIndex
DataFrame.append
DataFrame.nUnique
DataFrame.tensor
DataFrame.print
DataFrame.toCSV
DataFrame.toJSON
DataFrame.toExcel
DataFrame.sortValues
DataFrame.setIndex
DataFrame.resetIndex
DataFrame.rename
DataFrame.drop
DataFrame.asType
DataFrame.shape
DataFrame.axis
DataFrame.ndim
DataFrame.values
DataFrame.selectDtypes
DataFrame.ctypes
DataFrame.index
DataFrame.loc
DataFrame.iloc
DataFrame.at
DataFrame.iat
DataFrame.head
DataFrame.tail
DataFrame.sample
DataFrame.add
DataFrame.sub
DataFrame.mul
DataFrame.div
DataFrame.pow
DataFrame.mod
DataFrame.mean
DataFrame.median
DataFrame.min
DataFrame.max
DataFrame.std
DataFrame.var
DataFrame.count
DataFrame.round
DataFrame.cumSum
DataFrame.cumMin
DataFrame.cumMax
DataFrame.cumProd
DataFrame.copy
DataFrame.describe
DataFrame.sum
DataFrame.abs
DataFrame.query
DataFrame.addColumn
DataFrame.groupby
DataFrame.column
DataFrame.fillNa
DataFrame.isNa
DataFrame.dropNa
DataFrame.apply
DataFrame.applyMap
DataFrame.It
DataFrame.gt
DataFrame.le
DataFrame.ge
DataFrame.ne
DataFrame.eq
DataFrame.replace
Configuration Options
Plotting
Groupby
User Guides
Building Data Driven Applications with Danfo.js - Book
Contributing Guide
Release Notes
Powered By
GitBook
DataFrame.pow
Get Exponential power of dataframe and other, element-wise (binary operator pow).
danfo.DataFrame.pow(other, option)
Parameters
Type
Description
Default
other
DataFrame, Series, Array or Scalar
Object to raised to power 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
Exponential of
scalar with
DataFrame along default axis 1
Node
Browser
1
const
dfd
=
require
(
"danfojs-node"
)
2
3
let
data
=
{
4
"Col1"
:
[
10
,
45
,
56
,
10
],
5
"Col2"
:
[
23
,
20
,
10
,
24
]
6
}
7
let
df
=
new
dfd
.
DataFrame
(
data
)
8
9
let
df_new
=
df
.
pow
(
2
)
10
11
df_new
.
print
()
Copied!
1
Copied!
Output
1
╔════════════╤═══════════════════╤═══════════════════╗
2
║ │ Col1 │ Col2 ║
3
╟────────────┼───────────────────┼───────────────────╢
4
║ 0 │ 100 │ 529 ║
5
╟────────────┼───────────────────┼───────────────────╢
6
║ 1 │ 2025 │ 400 ║
7
╟────────────┼───────────────────┼───────────────────╢
8
║ 2 │ 3136 │ 100 ║
9
╟────────────┼───────────────────┼───────────────────╢
10
║ 3 │ 100 │ 576 ║
11
╚════════════╧═══════════════════╧═══════════════════╝
12
Copied!
Exponential of
Series with
DataFrame along axis 0
Node
Browser
1
const
dfd
=
require
(
"danfojs-node"
)
2
3
let
data
=
{
4
"Col1"
:
[
1
,
4
,
5
,
1
],
5
"Col2"
:
[
3
,
2
,
0
,
4
]
6
}
7
8
let
df
=
new
dfd
.
DataFrame
(
data
)
9
let
sf
=
new
dfd
.
Series
([
4
,
5
])
10
11
let
df_new
=
df
.
pow
(
sf
,
{
axis
:
1
})
12
13
df_new
.
print
()
Copied!
1
Copied!
Output
1
╔════════════╤═══════════════════╤═══════════════════╗
2
║ │ Col1 │ Col2 ║
3
╟────────────┼───────────────────┼───────────────────╢
4
║ 0 │ 1 │ 243 ║
5
╟────────────┼───────────────────┼───────────────────╢
6
║ 1 │ 256 │ 32 ║
7
╟────────────┼───────────────────┼───────────────────╢
8
║ 2 │ 625 │ 0 ║
9
╟────────────┼───────────────────┼───────────────────╢
10
║ 3 │ 1 │ 1024 ║
11
╚════════════╧═══════════════════╧═══════════════════╝
12
Copied!
Exponential of DataFrame with another DataFrame
Node
Browser
1
const
dfd
=
require
(
"danfojs"
)
2
3
let
data
=
{
"Col1"
:
[
1
,
4
,
5
,
0
],
4
"Col2"
:
[
2
,
0
,
1
,
4
]}
5
6
let
data2
=
{
"new_col1"
:
[
1
,
5
,
20
,
10
],
7
"new_Col2"
:
[
20
,
2
,
1
,
2
]}
8
9
let
df
=
new
dfd
.
DataFrame
(
data
)
10
let
df2
=
new
dfd
.
DataFrame
(
data2
)
11
12
let
df_new
=
df
.
pow
(
df2
)
13
14
df_new
.
print
()
Copied!
1
Copied!
Output
1
╔════════════╤═══════════════════╤═══════════════════╗
2
║ │ Col1 │ Col2 ║
3
╟────────────┼───────────────────┼───────────────────╢
4
║ 0 │ 1 │ 1048576 ║
5
╟────────────┼───────────────────┼───────────────────╢
6
║ 1 │ 1024 │ 0 ║
7
╟────────────┼───────────────────┼───────────────────╢
8
║ 2 │ 95367433551872 │ 1 ║
9
╟────────────┼───────────────────┼───────────────────╢
10
║ 3 │ 0 │ 16 ║
11
╚════════════╧═══════════════════╧═══════════════════╝
12
Copied!
Exponential of Array with DataFrame along axis 0
Node
Browser
1
const
dfd
=
require
(
"danfojs-node"
)
2
3
let
data
=
{
4
"Col1"
:
[
10
,
45
,
56
,
10
],
5
"Col2"
:
[
23
,
20
,
10
,
24
]
6
}
7
8
let
df
=
new
dfd
.
DataFrame
(
data
)
9
let
val
=
[
2
,
2
,
2
,
2
]
10
11
let
df_new
=
df
.
pow
(
val
,
{
axis
:
0
})
12
13
df_new
.
print
()
Copied!
1
Copied!
Output
1
╔════════════╤═══════════════════╤═══════════════════╗
2
║ │ Col1 │ Col2 ║
3
╟────────────┼───────────────────┼───────────────────╢
4
║ 0 │ 100 │ 529 ║
5
╟────────────┼───────────────────┼───────────────────╢
6
║ 1 │ 2025 │ 400 ║
7
╟────────────┼───────────────────┼───────────────────╢
8
║ 2 │ 3136 │ 100 ║
9
╟────────────┼───────────────────┼───────────────────╢
10
║ 3 │ 100 │ 576 ║
11
╚════════════╧═══════════════════╧═══════════════════╝
Copied!
Exponential works inplace
Node
Browser
1
const
dfd
=
require
(
"danfojs-node"
)
2
3
let
data
=
{
4
"Col1"
:
[
10
,
45
,
56
,
10
],
5
"Col2"
:
[
23
,
20
,
10
,
24
]
6
}
7
8
let
df
=
new
dfd
.
DataFrame
(
data
)
9
let
val
=
[
2
,
2
,
2
,
2
]
10
11
df
.
pow
(
val
,
{
axis
:
0
,
inplace
:
true
})
12
13
df
.
print
()
Copied!
1
Copied!
Output
1
╔════════════╤═══════════════════╤═══════════════════╗
2
║ │ Col1 │ Col2 ║
3
╟────────────┼───────────────────┼───────────────────╢
4
║ 0 │ 100 │ 529 ║
5
╟────────────┼───────────────────┼───────────────────╢
6
║ 1 │ 2025 │ 400 ║
7
╟────────────┼───────────────────┼───────────────────╢
8
║ 2 │ 3136 │ 100 ║
9
╟────────────┼───────────────────┼───────────────────╢
10
║ 3 │ 100 │ 576 ║
11
╚════════════╧═══════════════════╧═══════════════════╝
12
Copied!
Previous
DataFrame.div
Next
DataFrame.mod
Last modified
3mo ago
Copy link
Contents
Examples
Exponential of scalar with DataFrame along default axis 1
Exponential of Series with DataFrame along axis 0
Exponential of DataFrame with another DataFrame
Exponential of Array with DataFrame along axis 0
Exponential works inplace