zhengruifeng commented on code in PR #37953:
URL: https://github.com/apache/spark/pull/37953#discussion_r976100227
##########
python/pyspark/pandas/series.py:
##########
@@ -1002,19 +1007,23 @@ def cov(self, other: "Series", min_periods:
Optional[int] = None) -> float:
Examples
--------
>>> from pyspark.pandas.config import set_option, reset_option
- >>> set_option("compute.ops_on_diff_frames", True)
>>> s1 = ps.Series([0.90010907, 0.13484424, 0.62036035])
>>> s2 = ps.Series([0.12528585, 0.26962463, 0.51111198])
- >>> s1.cov(s2)
- -0.016857626527158744
- >>> reset_option("compute.ops_on_diff_frames")
+ >>> with ps.option_context("compute.ops_on_diff_frames", True):
+ ... s1.cov(s2)
+ -0.016857...
+ >>> with ps.option_context("compute.ops_on_diff_frames", True):
+ ... s1.cov(s2, ddof=2)
+ -0.033715...
"""
if not isinstance(other, Series):
raise TypeError("unsupported type: %s" % type(other))
if not np.issubdtype(self.dtype, np.number): # type: ignore[arg-type]
raise TypeError("unsupported dtype: %s" % self.dtype)
if not np.issubdtype(other.dtype, np.number): # type: ignore[arg-type]
raise TypeError("unsupported dtype: %s" % other.dtype)
+ if not isinstance(ddof, int):
+ raise TypeError("ddof must be integer")
Review Comment:
nice, willl update soon
##########
python/pyspark/pandas/series.py:
##########
@@ -993,6 +993,11 @@ def cov(self, other: "Series", min_periods: Optional[int]
= None) -> float:
Series with which to compute the covariance.
min_periods : int, optional
Minimum number of observations needed to have a valid result.
+ ddof : int, default 1
+ Delta degrees of freedom. The divisor used in calculations
Review Comment:
good catch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]