.log()
Published May 25, 2022
Contribute to Docs
The .log()
function returns an element-wise natural logarithm of an array.
Syntax
numpy.log(array)
.log()
returns an ndarray
with each element as the natural logarithm of the corresponding element in array
.
Example
The following example creates a ndarray
and applies .log()
to it:
import numpy as npnd = np.array([[1,2.71828],[2.71828,1]])print(nd)print(np.log(nd))
This produces the following output:
[[1. 2.71828][2.71828 1. ]][[0. 0.99999933][0.99999933 0. ]]
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.