Skip to content

Logarithm(base=None) Source

Bases: MathFunction

Logarithm of each value: with base=10, 1000 gives 3.

Applying it to a value lower than or equal to 0 raises OutOfDomainError. Missing values stay missing.

Changed in version 0.2.0

Gives FLOAT64 for integers of any size.

Version history (1)

Added in version 0.1.0

Parameters:

  • base (float | None, default: None)

    Base of the logarithm, greater than 0 and different from 1. The natural logarithm, of base e, when omitted.

Raises:

Examples:

import numdaplot as ndp

populations = ndp.Array.from_list([1, 100, 1000])
populations.apply(ndp.Logarithm(base=10))
# Array([0., 2., 3.], dtype=FLOAT64)