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# +-------+------------------+-----+