code: def log(s: "Series", error: str = "warn") -> "Series":
      """
      Take natural logarithm of the Series.
  
      Each value in the series should be positive. Use `error` to control the
      behavior if there are nonpositive entries in the series.
  
      Examples:
          >>> import pandas as pd
          >>> import janitor
          >>> s = pd.Series([0, 1, 3], name="numbers")
          >>> s.log(error="ignore")
          0         NaN
          1    0.000000
          2    1.098612
          Name: numbers, dtype: float64
  
      Args:
          s: Input Series.
          error: Determines behavior when taking the log of nonpositive
              entries. If `'warn'` then a `RuntimeWarning` is thrown. If
              `'raise'`, then a `RuntimeError` is thrown. Otherwise, nothing
              is thrown and log of nonpositive values is `np.nan`.
  
      Raises:
          RuntimeError: Raised when there are nonpositive values in the
              Series and `error='raise'`.
  
      Returns:
          Transformed Series.
      """
      import numpy as np
  
      s = s.copy()
      nonpositive = s <= 0
      if (nonpositive).any():
          msg = f"Log taken on {nonpositive.sum()} nonpositive value(s)"
          if error.lower() == "warn":
              warnings.warn(msg, RuntimeWarning)
          if error.lower() == "raise":
              raise RuntimeError(msg)
          else:
              pass
      s[nonpositive] = np.nan
      return np.log(s)
  
file_path: pyjanitor/janitor/math.py
imports: import warnings
  from typing import TYPE_CHECKING, Tuple
  import pandas_flavor
label_desc: Use image node_id 1 for calling a global function with example usage: log(s, error) and returns: np