class_docstr: Test nonparametric.py.
docstr: Test function cochran
  http://www.real-statistics.com/anova-repeated-measures/cochrans-q-test/
docstr_tok: ["Test","function","cochran","http",":","\/\/www.real-statistics.com\/anova-repeated-measures\/cochrans-q-test\/"]
code: def test_cochran(self):
      """Test function cochran
      http://www.real-statistics.com/anova-repeated-measures/cochrans-q-test/
      """
      from pingouin import read_dataset
  
      df = read_dataset("cochran")
      st = cochran(
          dv="Energetic", within="Time", subject="Subject", data=df
      )
      assert round(st.at["cochran", "Q"], 3) == 6.706
      assert np.isclose(st.at["cochran", "p-unc"], 0.034981)
      # With Categorical
      df["Time"] = df["Time"].astype("category")
      df["Subject"] = df["Subject"].astype("category")
      df["Time"] = df["Time"].cat.add_categories("Unused")
      st = cochran(
          dv="Energetic", within="Time", subject="Subject", data=df
      )
      assert round(st.at["cochran", "Q"], 3) == 6.706
      assert np.isclose(st.at["cochran", "p-unc"], 0.034981)
      # With a NaN value
      df.loc[2, "Energetic"] = np.nan
      cochran(dv="Energetic", within="Time", subject="Subject", data=df)
  
file_path: pingouin/pingouin/tests/test_nonparametric.py
imports: import pytest
  import scipy
  import numpy
  import pandas
  from unittest import TestCase
  from pingouin.nonparametric import mad, madmedianrule, mwu, wilcoxon, kruskal, friedman, cochran, harrelldavis
label_desc: Use image node_id 7 for calling the TestNonParametric obj's underlying member method code with example usage: obj.test_cochran() without return types