code: def remove_na(x, y=None, paired=False, axis="rows"):
      """Remove missing values along a given axis in one or more (paired) numpy arrays.
  
      Parameters
      ----------
      x, y : 1D or 2D arrays
          Data. ``x`` and ``y`` must have the same number of dimensions.
          ``y`` can be None to only remove missing values in ``x``.
      paired : bool
          Indicates if the measurements are paired or not.
      axis : str
          Axis or axes along which missing values are removed.
          Can be 'rows' or 'columns'. This has no effect if ``x`` and ``y`` are
          one-dimensional arrays.
  
      Returns
      -------
      x, y : np.ndarray
          Data without missing values
  
      Examples
      --------
      Single 1D array
  
      >>> import numpy as np
      >>> from pingouin import remove_na
      >>> x = [6.4, 3.2, 4.5, np.nan]
      >>> remove_na(x)
      array([6.4, 3.2, 4.5])
  
      With two paired 1D arrays
  
      >>> y = [2.3, np.nan, 5.2, 4.6]
      >>> remove_na(x, y, paired=True)
      (array([6.4, 4.5]), array([2.3, 5.2]))
  
      With two independent 2D arrays
  
      >>> x = np.array([[4, 2], [4, np.nan], [7, 6]])
      >>> y = np.array([[6, np.nan], [3, 2], [2, 2]])
      >>> x_no_nan, y_no_nan = remove_na(x, y, paired=False)
      """
      # Safety checks
      x = np.asarray(x)
      assert axis in [
          "rows",
          "columns",
      ], "axis must be rows or columns."
  
      if y is None:
          return _remove_na_single(x, axis=axis)
      elif isinstance(y, (int, float, str)):
          return _remove_na_single(x, axis=axis), y
      else:  # y is list, np.array, pd.Series
          y = np.asarray(y)
          assert y.size != 0, "y cannot be an empty list or array."
          # Make sure that we just pass-through if y have only 1 element
          if y.size == 1:
              return _remove_na_single(x, axis=axis), y
          if x.ndim != y.ndim or paired is False:
              # x and y do not have the same dimension
              x_no_nan = _remove_na_single(x, axis=axis)
              y_no_nan = _remove_na_single(y, axis=axis)
              return x_no_nan, y_no_nan
  
      # At this point, we assume that x and y are paired and have same dimensions
      if x.ndim == 1:
          # 1D arrays
          x_mask = ~np.isnan(x)
          y_mask = ~np.isnan(y)
      else:
          # 2D arrays
          ax = 1 if axis == "rows" else 0
          x_mask = ~np.any(np.isnan(x), axis=ax)
          y_mask = ~np.any(np.isnan(y), axis=ax)
  
      # Check if missing values are present
      if ~x_mask.all() or ~y_mask.all():
          ax = 0 if axis == "rows" else 1
          ax = 0 if x.ndim == 1 else ax
          both = np.logical_and(x_mask, y_mask)
          x = x.compress(both, axis=ax)
          y = y.compress(both, axis=ax)
      return x, y
  
file_path: pingouin/pingouin/utils.py
imports: import numbers
  import numpy
  import pandas
  import itertools
  import collections.abc
  from tabulate import tabulate
  from .config import options
label_desc: Use image node_id 6 for calling a global function with example usage: remove_na(x, y, paired, axis) and returns: x,  y, _remove_na_single, _remove_na_single,  y, _remove_na_single,  y, x_no_nan,  y_no_nan