Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/5073#discussion_r26632169
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala ---
@@ -752,6 +752,55 @@ class DataFrame private[sql](
}
/**
+ * Compute numerical statistics for given columns of this [[DataFrame]]:
+ * count, mean (avg), stddev (standard deviation), min, max.
+ * Each row of the resulting [[DataFrame]] contains column with
statistic name
+ * and columns with statistic results for each given column.
+ * If no columns are given then computes for all numerical columns.
+ *
+ * {{{
+ * df.describe("age", "height")
+ *
+ * // summary age height
+ * // count 10.0 10.0
+ * // mean 53.3 178.05
+ * // stddev 11.6 15.7
+ * // min 18.0 163.0
+ * // max 92.0 192.0
+ * }}}
+ */
+ @scala.annotation.varargs
+ def describe(cols: String*): DataFrame = {
+
+ def aggCol(name: String = "") = s"'$name' as summary"
+ val statistics = List[(String, Expression => Expression)](
+ "count" -> (expr => Count(expr)),
--- End diff --
do you mind getting rid of the vertical alignment (i.e. don't align the
"->")?
---
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]