To get Numpy log base 10 use numpy.log10() function. This function calculates the Base-10 logarithm of x where x belongs to all the input array elements.
numpy.log10(arr, out = None, *, where = True, casting = ‘same_kind’, order = ‘K’, dtype = None, ufunc ‘log10’)
This function returns a new array containing the base-10 logarithm of each element in the input array.
Numpy log base 10 example
Simple example code using the log10()
function to get the logarithm of an array in NumPy with a base of 10
import numpy as np arr = np.array([1, 10, 100, 1000]) result = np.log10(arr) print(result)
Output:
Do comment if you have any doubts or suggestions on this Python Numpy log topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
Windows 10
Python 3.10.1
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.