pandas/core/window/ewm.py
def corr(
        self,
        other: Optional[Union[np.ndarray, FrameOrSeries]] = None,
        pairwise: Optional[bool] = None,
        **kwargs,
    ):
        """
        Exponential weighted sample correlation.

        Parameters
        ----------
        other : Series, DataFrame, or ndarray, optional
            If not supplied then will default to self and produce pairwise
            output.
        pairwise : bool, default None
            If False then only matching columns between self and other will be
            used and the output will be a DataFrame.
            If True then all pairwise combinations will be calculated and the
            output will be a MultiIndex DataFrame in the case of DataFrame
            inputs. In the case of missing elements, only complete pairwise
            observations will be used.
        **kwargs
           Keyword arguments to be passed into func.
        """
        if other is None:
            other = self._selected_obj
            # only default unset
            pairwise = True if pairwise is None else pairwise
        other = self._shallow_copy(other)

        def _get_corr(X, Y):
            X = self._shallow_copy(X)
            Y = self._shallow_copy(Y)

            def _cov(x, y):
                return window_aggregations.ewmcov(
                    x,
                    np.array([0], dtype=np.int64),
                    np.array([0], dtype=np.int64),
                    self.min_periods,
                    y,
                    self.com,
                    self.adjust,
                    self.ignore_na,
                    1,
                )

            x_values = X._prep_values()
            y_values = Y._prep_values()
            with np.errstate(all="ignore"):
                cov = _cov(x_values, y_values)
                x_var = _cov(x_values, x_values)
                y_var = _cov(y_values, y_values)
                corr = cov / zsqrt(x_var * y_var)
            return wrap_result(X, corr)

        return flex_binary_moment(
            self._selected_obj, other._selected_obj, _get_corr, pairwise=bool(pairwise)
        )

        Exponential weighted sample correlation.

        Parameters
        ----------
        other : Series, DataFrame, or ndarray, optional
            If not supplied then will default to self and produce pairwise
            output.
        pairwise : bool, default None
            If False then only matching columns between self and other will be
            used and the output will be a DataFrame.
            If True then all pairwise combinations will be calculated and the
            output will be a MultiIndex DataFrame in the case of DataFrame
            inputs. In the case of missing elements, only complete pairwise
            observations will be used.
        **kwargs
           Keyword arguments to be passed into func.
        
Exponential weighted sample correlation.
Parameters

other : Series, DataFrame, or ndarray, optional
If not supplied then will default to self and produce pairwise
output.
pairwise : bool, default None
If False then only matching columns between self and other will be
used and the output will be a DataFrame.
If True then all pairwise combinations will be calculated and the
output will be a MultiIndex DataFrame in the case of DataFrame
inputs. In the case of missing elements, only complete pairwise
observations will be used.
kwargs
Keyword arguments to be passed into func.
Exponential weighted sample correlation . Parameters other : Series DataFrame or ndarray optional If not supplied then will default to self and produce pairwise output . pairwise : bool default None If False then only matching columns between self and other will be used and the output will be a DataFrame . If True then all pairwise combinations will be calculated and the output will be a MultiIndex DataFrame in the case of DataFrame inputs . In the case of missing elements only complete pairwise observations will be used . kwargs Keyword arguments to be passed into func .
def corr(
        self,
        other: Optional[Union[np.ndarray, FrameOrSeries]] = None,
        pairwise: Optional[bool] = None,
        **kwargs,
    ):
        if other is None:
            other = self._selected_obj
            pairwise = True if pairwise is None else pairwise
        other = self._shallow_copy(other)
        def _get_corr(X, Y):
            X = self._shallow_copy(X)
            Y = self._shallow_copy(Y)
            def _cov(x, y):
                return window_aggregations.ewmcov(
                    x,
                    np.array([0], dtype=np.int64),
                    np.array([0], dtype=np.int64),
                    self.min_periods,
                    y,
                    self.com,
                    self.adjust,
                    self.ignore_na,
                    1,
                )
            x_values = X._prep_values()
            y_values = Y._prep_values()
            with np.errstate(all="ignore"):
                cov = _cov(x_values, y_values)
                x_var = _cov(x_values, x_values)
                y_var = _cov(y_values, y_values)
                corr = cov / zsqrt(x_var * y_var)
            return wrap_result(X, corr)
        return flex_binary_moment(
            self._selected_obj, other._selected_obj, _get_corr, pairwise=bool(pairwise)
        )
def corr ( self , other : Optional [ Union [ np . ndarray , FrameOrSeries ] ] = None , pairwise : Optional [ bool ] = None , ** kwargs , ) : if other is None : other = self . _selected_obj pairwise = True if pairwise is None else pairwise other = self . _shallow_copy ( other ) def _get_corr ( X , Y ) : X = self . _shallow_copy ( X ) Y = self . _shallow_copy ( Y ) def _cov ( x , y ) : return window_aggregations . ewmcov ( x , np . array ( [ 0 ] , dtype = np . int64 ) , np . array ( [ 0 ] , dtype = np . int64 ) , self . min_periods , y , self . com , self . adjust , self . ignore_na , 1 , ) x_values = X . _prep_values ( ) y_values = Y . _prep_values ( ) with np . errstate ( all = "ignore" ) : cov = _cov ( x_values , y_values ) x_var = _cov ( x_values , x_values ) y_var = _cov ( y_values , y_values ) corr = cov / zsqrt ( x_var * y_var ) return wrap_result ( X , corr ) return flex_binary_moment ( self . _selected_obj , other . _selected_obj , _get_corr , pairwise = bool ( pairwise ) )
Exponential weighted sample correlation.
Exponential weighted sample correlation .
"""
        Exponential weighted sample correlation.

        Parameters
        ----------
        other : Series, DataFrame, or ndarray, optional
            If not supplied then will default to self and produce pairwise
            output.
        pairwise : bool, default None
            If False then only matching columns between self and other will be
            used and the output will be a DataFrame.
            If True then all pairwise combinations will be calculated and the
            output will be a MultiIndex DataFrame in the case of DataFrame
            inputs. In the case of missing elements, only complete pairwise
            observations will be used.
        **kwargs
           Keyword arguments to be passed into func.
        """ # only default unset
self
other
Optional[Union[np.ndarray, FrameOrSeries]]
pairwise
Optional[bool]