np.log()函数是用来计算数组中每个元素的自然对数的。自然对数是以数学常数e(约等于2.71828)为底的对数。NumPy作为一个强大的数值计算库,提供了很多用于数组操作的函数,np.log()就是其中之一。
•
下面是一个简单的例子,展示了如何使用
np.log()
函数:
import numpy as np
lst1 = [1, 10, 100, 1000]
print(np.log(lst1))
# [0. 2.30258509 4.60517019 6.90775528]

