#NEWLINE# def cov( self , other = None , pairwise = None , ddof = 1 , **kwargs ) : #NEWLINE# #INDENT# if ( other is None ) : #NEWLINE# #INDENT# other = self . _selected_obj #NEWLINE# pairwise = ( True if ( pairwise is None ) else pairwise ) #NEWLINE# #UNINDENT# other = self . _shallow_copy ( window ) #NEWLINE# window = self . _get_window ( other ) #NEWLINE# def _get_cov( X , Y ) : #NEWLINE# #INDENT# X = X . astype ( 'float64' ) #NEWLINE# Y = Y . astype ( 'float64' ) #NEWLINE# mean = ( lambda x : x . rolling ( window , self . min_periods , center = self . center ) . mean ( ** kwargs ) ) #NEWLINE# count = ( X + Y ) . rolling ( window = window , center = self . center ) . count ( ** kwargs ) #NEWLINE# bias_adj = ( count / ( count - ddof ) ) #NEWLINE# return ( ( mean ( ( X * Y ) ) - ( mean ( X ) * mean ( Y ) ) ) * bias_adj ) #NEWLINE# #UNINDENT# return _flex_binary_moment ( self . _selected_obj , other . _selected_obj , _get_cov , pairwise = bool ( pairwise ) )