Computes statistics for numeric and string columns code example
Example: Computes statistics for numeric and string columns
# Computes statistics for numeric and string columns
df.describe(['age']).show()
# +-------+------------------+
# |summary| age|
# +-------+------------------+
# | count| 2|
# | mean| 3.5|
# | stddev|2.1213203435596424|
# | min| 2|
# | max| 5|
# +-------+------------------+
df.describe().show()
# +-------+------------------+-----+
# |summary| age| name|
# +-------+------------------+-----+
# | count| 2| 2|
# | mean| 3.5| null|
# | stddev|2.1213203435596424| null|
# | min| 2|Alice|
# | max| 5| Bob|
# +-------+------------------+-----+