class_docstr: Test utils.py.
class_docstr_tok: ["Test","utils.py","."]
docstr: Test function remove_na.
docstr_tok: ["Test","function","remove_na","."]
code: def test_remove_na(self):
      """Test function remove_na."""
      x = [6.4, 3.2, 4.5, np.nan]
      y = [3.5, 7.2, 8.4, 3.2]
      z = [2.3, np.nan, 5.2, 4.6]
      remove_na(x, y, paired=True)
      remove_na(x, y, paired=False)
      remove_na(y, x, paired=False)
      x_out, _ = remove_na(x, z, paired=True)
      assert np.allclose(x_out, [6.4, 4.5])
      # When y is None
      remove_na(x, None)
      remove_na(x, 4)
      # With 2D arrays
      x = np.array([[4, 2], [4, np.nan], [7, 6]])
      y = np.array([[6, np.nan], [3, 2], [2, 2]])
      x_nan, y_nan = remove_na(x, y, paired=False)
      assert np.allclose(x_nan, [[4.0, 2.0], [7.0, 6.0]])
      assert np.allclose(y_nan, [[3.0, 2.0], [2.0, 2.0]])
      x_nan, y_nan = remove_na(x, y, paired=True)
      assert np.allclose(x_nan, [[7.0, 6.0]])
      assert np.allclose(y_nan, [[2.0, 2.0]])
      x_nan, y_nan = remove_na(x, y, paired=False, axis="columns")
      assert np.allclose(x_nan, [[4.0], [4.0], [7.0]])
      assert np.allclose(y_nan, [[6.0], [3.0], [2.0]])
      # When y is None
      remove_na(x, None, paired=False)
      # When y is an empty list
      # See https://github.com/raphaelvallat/pingouin/issues/222
      with pytest.raises(AssertionError):
          remove_na(x, y=[])
  
file_path: pingouin/pingouin/tests/test_utils.py
imports: import pandas
  import numpy
  import pytest
  import pingouin
  from unittest import TestCase
  from pingouin.utils import print_table, _postprocess_dataframe, _get_round_setting_for, _perm_pval, _check_eftype, _check_dataframe, remove_na, _flatten_list, _is_sklearn_installed, _is_statsmodels_installed, _is_mpmath_installed
label_desc: Use image node_id 6 for calling the TestUtils obj's underlying member method code with example usage: obj.test_remove_na() without return types