def cov(self, min_periods: Optional[int]=None) -> 'DataFrame':
    "\n        Compute pairwise covariance of columns, excluding NA/null values.\n\n        Compute the pairwise covariance among the series of a DataFrame.\n        The returned data frame is the `covariance matrix\n        <https://en.wikipedia.org/wiki/Covariance_matrix>`__ of the columns\n        of the DataFrame.\n\n        Both NA and null values are automatically excluded from the\n        calculation. (See the note below about bias from missing values.)\n        A threshold can be set for the minimum number of\n        observations for each value created. Comparisons with observations\n        below this threshold will be returned as ``NaN``.\n\n        This method is generally used for the analysis of time series data to\n        understand the relationship between different measures\n        across time.\n\n        .. versionadded:: 3.3.0\n\n        Parameters\n        ----------\n        min_periods : int, optional\n            Minimum number of observations required per pair of columns\n            to have a valid result.\n\n        Returns\n        -------\n        DataFrame\n            The covariance matrix of the series of the DataFrame.\n\n        See Also\n        --------\n        Series.cov : Compute covariance with another Series.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame([(1, 2), (0, 3), (2, 0), (1, 1)],\n        ...                   columns=['dogs', 'cats'])\n        >>> df.cov()\n                  dogs      cats\n        dogs  0.666667 -1.000000\n        cats -1.000000  1.666667\n\n        >>> np.random.seed(42)\n        >>> df = ps.DataFrame(np.random.randn(1000, 5),\n        ...                   columns=['a', 'b', 'c', 'd', 'e'])\n        >>> df.cov()\n                  a         b         c         d         e\n        a  0.998438 -0.020161  0.059277 -0.008943  0.014144\n        b -0.020161  1.059352 -0.008543 -0.024738  0.009826\n        c  0.059277 -0.008543  1.010670 -0.001486 -0.000271\n        d -0.008943 -0.024738 -0.001486  0.921297 -0.013692\n        e  0.014144  0.009826 -0.000271 -0.013692  0.977795\n\n        **Minimum number of periods**\n\n        This method also supports an optional ``min_periods`` keyword\n        that specifies the required minimum number of non-NA observations for\n        each column pair in order to have a valid result:\n\n        >>> np.random.seed(42)\n        >>> df = pd.DataFrame(np.random.randn(20, 3),\n        ...                   columns=['a', 'b', 'c'])\n        >>> df.loc[df.index[:5], 'a'] = np.nan\n        >>> df.loc[df.index[5:10], 'b'] = np.nan\n        >>> sdf = ps.from_pandas(df)\n        >>> sdf.cov(min_periods=12)\n                  a         b         c\n        a  0.316741       NaN -0.150812\n        b       NaN  1.248003  0.191417\n        c -0.150812  0.191417  0.895202\n        "
    min_periods = (1 if (min_periods is None) else min_periods)
    psdf = self[[col for col in self.columns if (isinstance(self[col].spark.data_type, BooleanType) or (isinstance(self[col].spark.data_type, NumericType) and (not isinstance(self[col].spark.data_type, DecimalType))))]]
    num_cols = len(psdf.columns)
    cov = np.zeros([num_cols, num_cols])
    if (num_cols == 0):
        return DataFrame()
    if (len(psdf) < min_periods):
        cov.fill(np.nan)
        return DataFrame(cov, columns=psdf.columns, index=psdf.columns)
    data_cols = psdf._internal.data_spark_column_names
    cov_scols = []
    count_not_null_scols = []
    for r in range(0, num_cols):
        for c in range(r, num_cols):
            count_not_null_scols.append(F.count(F.when((F.col(data_cols[r]).isNotNull() & F.col(data_cols[c]).isNotNull()), 1)))
    count_not_null = psdf._internal.spark_frame.replace(float('nan'), None).select(*count_not_null_scols).head(1)[0]
    step = 0
    for r in range(0, num_cols):
        step += r
        for c in range(r, num_cols):
            cov_scols.append((F.covar_samp(F.col(data_cols[r]).cast('double'), F.col(data_cols[c]).cast('double')) if (count_not_null[(((r * num_cols) + c) - step)] >= min_periods) else F.lit(None)))
    pair_cov = psdf._internal.spark_frame.select(*cov_scols).head(1)[0]
    step = 0
    for r in range(0, num_cols):
        step += r
        for c in range(r, num_cols):
            cov[r][c] = pair_cov[(((r * num_cols) + c) - step)]
    cov = ((cov + cov.T) - np.diag(np.diag(cov)))
    return DataFrame(cov, columns=psdf.columns, index=psdf.columns)
Compute pairwise covariance of columns, excluding NA/null values.

Compute the pairwise covariance among the series of a DataFrame.
The returned data frame is the `covariance matrix
<https://en.wikipedia.org/wiki/Covariance_matrix>`__ of the columns
of the DataFrame.

Both NA and null values are automatically excluded from the
calculation. (See the note below about bias from missing values.)
A threshold can be set for the minimum number of
observations for each value created. Comparisons with observations
below this threshold will be returned as ``NaN``.

This method is generally used for the analysis of time series data to
understand the relationship between different measures
across time.

.. versionadded:: 3.3.0

Parameters
----------
min_periods : int, optional
    Minimum number of observations required per pair of columns
    to have a valid result.

Returns
-------
DataFrame
    The covariance matrix of the series of the DataFrame.

See Also
--------
Series.cov : Compute covariance with another Series.

Examples
--------
>>> df = ps.DataFrame([(1, 2), (0, 3), (2, 0), (1, 1)],
...                   columns=['dogs', 'cats'])
>>> df.cov()
          dogs      cats
dogs  0.666667 -1.000000
cats -1.000000  1.666667

>>> np.random.seed(42)
>>> df = ps.DataFrame(np.random.randn(1000, 5),
...                   columns=['a', 'b', 'c', 'd', 'e'])
>>> df.cov()
          a         b         c         d         e
a  0.998438 -0.020161  0.059277 -0.008943  0.014144
b -0.020161  1.059352 -0.008543 -0.024738  0.009826
c  0.059277 -0.008543  1.010670 -0.001486 -0.000271
d -0.008943 -0.024738 -0.001486  0.921297 -0.013692
e  0.014144  0.009826 -0.000271 -0.013692  0.977795

**Minimum number of periods**

This method also supports an optional ``min_periods`` keyword
that specifies the required minimum number of non-NA observations for
each column pair in order to have a valid result:

>>> np.random.seed(42)
>>> df = pd.DataFrame(np.random.randn(20, 3),
...                   columns=['a', 'b', 'c'])
>>> df.loc[df.index[:5], 'a'] = np.nan
>>> df.loc[df.index[5:10], 'b'] = np.nan
>>> sdf = ps.from_pandas(df)
>>> sdf.cov(min_periods=12)
          a         b         c
a  0.316741       NaN -0.150812
b       NaN  1.248003  0.191417
c -0.150812  0.191417  0.895202
def cov(self, min_periods: Optional[int]=None) -> 'DataFrame':
    "\n        Compute pairwise covariance of columns, excluding NA/null values.\n\n        Compute the pairwise covariance among the series of a DataFrame.\n        The returned data frame is the `covariance matrix\n        <https://en.wikipedia.org/wiki/Covariance_matrix>`__ of the columns\n        of the DataFrame.\n\n        Both NA and null values are automatically excluded from the\n        calculation. (See the note below about bias from missing values.)\n        A threshold can be set for the minimum number of\n        observations for each value created. Comparisons with observations\n        below this threshold will be returned as ``NaN``.\n\n        This method is generally used for the analysis of time series data to\n        understand the relationship between different measures\n        across time.\n\n        .. versionadded:: 3.3.0\n\n        Parameters\n        ----------\n        min_periods : int, optional\n            Minimum number of observations required per pair of columns\n            to have a valid result.\n\n        Returns\n        -------\n        DataFrame\n            The covariance matrix of the series of the DataFrame.\n\n        See Also\n        --------\n        Series.cov : Compute covariance with another Series.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame([(1, 2), (0, 3), (2, 0), (1, 1)],\n        ...                   columns=['dogs', 'cats'])\n        >>> df.cov()\n                  dogs      cats\n        dogs  0.666667 -1.000000\n        cats -1.000000  1.666667\n\n        >>> np.random.seed(42)\n        >>> df = ps.DataFrame(np.random.randn(1000, 5),\n        ...                   columns=['a', 'b', 'c', 'd', 'e'])\n        >>> df.cov()\n                  a         b         c         d         e\n        a  0.998438 -0.020161  0.059277 -0.008943  0.014144\n        b -0.020161  1.059352 -0.008543 -0.024738  0.009826\n        c  0.059277 -0.008543  1.010670 -0.001486 -0.000271\n        d -0.008943 -0.024738 -0.001486  0.921297 -0.013692\n        e  0.014144  0.009826 -0.000271 -0.013692  0.977795\n\n        **Minimum number of periods**\n\n        This method also supports an optional ``min_periods`` keyword\n        that specifies the required minimum number of non-NA observations for\n        each column pair in order to have a valid result:\n\n        >>> np.random.seed(42)\n        >>> df = pd.DataFrame(np.random.randn(20, 3),\n        ...                   columns=['a', 'b', 'c'])\n        >>> df.loc[df.index[:5], 'a'] = np.nan\n        >>> df.loc[df.index[5:10], 'b'] = np.nan\n        >>> sdf = ps.from_pandas(df)\n        >>> sdf.cov(min_periods=12)\n                  a         b         c\n        a  0.316741       NaN -0.150812\n        b       NaN  1.248003  0.191417\n        c -0.150812  0.191417  0.895202\n        "
    min_periods = (1 if (min_periods is None) else min_periods)
    psdf = self[[col for col in self.columns if (isinstance(self[col].spark.data_type, BooleanType) or (isinstance(self[col].spark.data_type, NumericType) and (not isinstance(self[col].spark.data_type, DecimalType))))]]
    num_cols = len(psdf.columns)
    cov = np.zeros([num_cols, num_cols])
    if (num_cols == 0):
        return DataFrame()
    if (len(psdf) < min_periods):
        cov.fill(np.nan)
        return DataFrame(cov, columns=psdf.columns, index=psdf.columns)
    data_cols = psdf._internal.data_spark_column_names
    cov_scols = []
    count_not_null_scols = []
    for r in range(0, num_cols):
        for c in range(r, num_cols):
            count_not_null_scols.append(F.count(F.when((F.col(data_cols[r]).isNotNull() & F.col(data_cols[c]).isNotNull()), 1)))
    count_not_null = psdf._internal.spark_frame.replace(float('nan'), None).select(*count_not_null_scols).head(1)[0]
    step = 0
    for r in range(0, num_cols):
        step += r
        for c in range(r, num_cols):
            cov_scols.append((F.covar_samp(F.col(data_cols[r]).cast('double'), F.col(data_cols[c]).cast('double')) if (count_not_null[(((r * num_cols) + c) - step)] >= min_periods) else F.lit(None)))
    pair_cov = psdf._internal.spark_frame.select(*cov_scols).head(1)[0]
    step = 0
    for r in range(0, num_cols):
        step += r
        for c in range(r, num_cols):
            cov[r][c] = pair_cov[(((r * num_cols) + c) - step)]
    cov = ((cov + cov.T) - np.diag(np.diag(cov)))
    return DataFrame(cov, columns=psdf.columns, index=psdf.columns)