NumPy Tutorial NumPy Statistics NumPy References

NumPy - log10() function



The NumPy log10() function is used to calculate the base-10 logarithm of a given value.

Syntax

numpy.log10(x, out=None)

Parameters

x Required. Specify array (array_like) containing elements, of which the base-10 logarithm is calculated.
out Optional. Specify a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.

Return Value

Returns the base-10 logarithm of each element of x.

Example:

In the example below, numpy log10() function is used to calculate the base-10 logarithm of each element present in array Arr.

import numpy as np

Arr = np.array([1, 5, 10, 50])

print("The base-10 logarithm of values:")
print(np.log10(Arr))

The output of the above code will be:

The base-10 logarithm of values:
[ 0.       0.69897  1.       1.69897]

❮ NumPy - Functions