Github user holdenk commented on a diff in the pull request:
https://github.com/apache/spark/pull/10876#discussion_r51206556
--- Diff: python/pyspark/sql/functions.py ---
@@ -263,6 +263,38 @@ def corr(col1, col2):
return Column(sc._jvm.functions.corr(_to_java_column(col1),
_to_java_column(col2)))
+@since(2.0)
+def covar_pop(col1, col2):
+ """Returns a new :class:`Column` for the population covariance of
``col1``
+ and ``col2``.
+
+ >>> a = [x * x - 2 * x + 3.5 for x in range(20)]
+ >>> b = range(20)
+ >>> df = sqlContext.createDataFrame(zip(a, b), ["a", "b"])
+ >>> covDf = df.agg(covar_pop("a", "b").alias('c'))
+ >>> covDf.selectExpr('abs(c - 565.25) < 1e-16 as t').collect()
--- End diff --
So just as a side note - it seems the other functions (including corr) do
have these tests for correctness in their doctests. We should probably be
consistent with them one way or the other yes?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]