computes statistics for numeric and string columns

Solutions on MaxInterview for computes statistics for numeric and string columns by the best coders in the world

showing results for - "computes statistics for numeric and string columns"
Anthony
17 Apr 2020
1# Computes statistics for numeric and string columns
2
3df.describe(['age']).show()
4# +-------+------------------+
5# |summary|               age|
6# +-------+------------------+
7# |  count|                 2|
8# |   mean|               3.5|
9# | stddev|2.1213203435596424|
10# |    min|                 2|
11# |    max|                 5|
12# +-------+------------------+
13df.describe().show()
14# +-------+------------------+-----+
15# |summary|               age| name|
16# +-------+------------------+-----+
17# |  count|                 2|    2|
18# |   mean|               3.5| null|
19# | stddev|2.1213203435596424| null|
20# |    min|                 2|Alice|
21# |    max|                 5|  Bob|
22# +-------+------------------+-----+