code: def test_dataframe_corr(self):
      pdf = pd.DataFrame(
          index=[
              "".join(
                  np.random.choice(
                      list(
                          "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
                      ),
                      10,
                  )
              )
              for _ in range(30)
          ],
          columns=list("ABCD"),
          dtype="float64",
      )
      psdf = ps.from_pandas(pdf)
  
      with self.assertRaisesRegex(ValueError, "Invalid method"):
          psdf.corr("std")
      with self.assertRaisesRegex(
          TypeError, "Invalid min_periods type"
      ):
          psdf.corr(min_periods="3")
  
      for method in ["pearson", "spearman", "kendall"]:
          self.assert_eq(
              psdf.corr(method=method),
              pdf.corr(method=method),
              check_exact=False,
          )
          self.assert_eq(
              psdf.corr(method=method, min_periods=1),
              pdf.corr(method=method, min_periods=1),
              check_exact=False,
          )
          self.assert_eq(
              psdf.corr(method=method, min_periods=3),
              pdf.corr(method=method, min_periods=3),
              check_exact=False,
          )
          self.assert_eq(
              (psdf + 1).corr(method=method, min_periods=2),
              (pdf + 1).corr(method=method, min_periods=2),
              check_exact=False,
          )
  
      # multi-index columns
      columns = pd.MultiIndex.from_tuples(
          [("X", "A"), ("X", "B"), ("Y", "C"), ("Z", "D")]
      )
      pdf.columns = columns
      psdf.columns = columns
  
      for method in ["pearson", "spearman", "kendall"]:
          self.assert_eq(
              psdf.corr(method=method),
              pdf.corr(method=method),
              check_exact=False,
          )
          self.assert_eq(
              psdf.corr(method=method, min_periods=1),
              pdf.corr(method=method, min_periods=1),
              check_exact=False,
          )
          self.assert_eq(
              psdf.corr(method=method, min_periods=3),
              pdf.corr(method=method, min_periods=3),
              check_exact=False,
          )
          self.assert_eq(
              (psdf + 1).corr(method=method, min_periods=2),
              (pdf + 1).corr(method=method, min_periods=2),
              check_exact=False,
          )
  
      # test with identical values
      pdf = pd.DataFrame(
          {
              "a": [0, 1, 1, 1, 0],
              "b": [2, 2, -1, 1, np.nan],
              "c": [3, 3, 3, 3, 3],
              "d": [np.nan, np.nan, np.nan, np.nan, np.nan],
          }
      )
      psdf = ps.from_pandas(pdf)
  
      for method in ["pearson", "spearman", "kendall"]:
          self.assert_eq(
              psdf.corr(method=method),
              pdf.corr(method=method),
              check_exact=False,
          )
          self.assert_eq(
              psdf.corr(method=method, min_periods=1),
              pdf.corr(method=method, min_periods=1),
              check_exact=False,
          )
          self.assert_eq(
              psdf.corr(method=method, min_periods=3),
              pdf.corr(method=method, min_periods=3),
              check_exact=False,
          )
  
file_path: spark/python/pyspark/pandas/tests/computation/test_corr.py
imports: import unittest
  import numpy
  import pandas
  from pyspark import pandas
  from pyspark.testing.pandasutils import PandasOnSparkTestCase, SPARK_CONF_ARROW_ENABLED
  from pyspark.testing.sqlutils import SQLTestUtils
label_desc: Use image node_id 1 for calling the FrameCorrMixin obj's underlying member method code with example usage: obj.test_dataframe_corr() without return types