code: def _yeojohnson_transform(x, lmbda):
      """Returns `x` transformed by the Yeo-Johnson power transform with given
      parameter `lmbda`.
      """
      out = np.zeros_like(x)
      pos = x >= 0  # binary mask
  
      # when x >= 0
      if abs(lmbda) < np.spacing(1.0):
          out[pos] = np.log1p(x[pos])
      else:  # lmbda != 0
          out[pos] = (np.power(x[pos] + 1, lmbda) - 1) / lmbda
  
      # when x < 0
      if abs(lmbda - 2) > np.spacing(1.0):
          out[~pos] = -(np.power(-x[~pos] + 1, 2 - lmbda) - 1) / (
              2 - lmbda
          )
      else:  # lmbda == 2
          out[~pos] = -np.log1p(-x[~pos])
  
      return out
  
imports: from __future__ import annotations
  import math
  import warnings
  from collections import namedtuple
  import numpy
  from numpy import isscalar, r_, log, around, unique, asarray, zeros, arange, sort, amin, amax, atleast_1d, sqrt, array, compress, pi, exp, ravel, count_nonzero, sin, cos, arctan2, hypot
  from scipy import optimize
  from scipy import special
  from .None import statlib
  from .None import stats
  from .stats import find_repeats, _contains_nan, _normtest_finish
  from .contingency import chi2_contingency
  from .None import distributions
  from ._distn_infrastructure import rv_generic
  from ._hypotests import _get_wilcoxon_distr
label_desc: Use image node_id 18 for calling a global function with example usage: _yeojohnson_transform(x, lmbda) and returns: out