python - Can't figure out why numpy.log10 outputs nan? -
so have 500k array of floating values. when trying to:
np.log10(my_long_array)
270k numbers getting replaced nan, , not small. example:
in [1]: import numpy np in [2]: t = -0.055488893531690543 in [3]: np.log10(t) /home/aydar/anaconda3/bin/ipython:1: runtimewarning: invalid value encountered in log10 #!/home/aydar/anaconda3/bin/python3 out[3]: nan in [4]: type(t) out[4]: float
what missing?
the logarithm of negative number undefined, hence nan
from docs numpy.log10
:
returns: y : ndarray
the logarithm base 10 of x, element-wise. nans returned x negative.
Comments
Post a Comment