concept summary() in category pyspark

This is an excerpt from Manning's book Data Analysis with Python and PySpark.
describe()is a fantastic method, but what if you want more?summary()at the rescue!Where
describe()will take*colsas a parameter (one or more columns, the same way asselect()ordrop()),summary()will take*statisticsas a parameter. This means that you’ll need to select the columns you want to see before passing thesummary()method. On the other hand, we can customize the statistics we want to see. By default,summary()shows everythingdescribe()shows, adding the approximate 25%-50% and 75% percentiles. Listing 4.17 shows how you can replacedescribe()forsummary()and the result of doing so.Listing 4.17. Summarizing everything in one fell swoop: default or custom options.
for i in logs.columns: logs.select(i).summary().show() #1 # +-------+------------------+ # |summary| LogServiceID| # +-------+------------------+ # | count| 7169318| # | mean|3453.8804215407936| # | stddev|200.44137201584468| # | min| 3157| # | 25%| 3291| # | 50%| 3384| # | 75%| 3628| # | max| 3925| # +-------+------------------+ # # [... many more slightly larger tables] for i in logs.columns: logs.select(i).summary("min", "10%", "90%", "max").show() #2 # +-------+------------+ # |summary|LogServiceID| # +-------+------------+ # | min| 3157| # | 10%| 3237| # | 90%| 3710| # | max| 3925| # +-------+------------+ # # [...]If you want to limit yourself to a subset of those metrics,
summary()will accept a number of string parameters representing the statistic. You can inputcount,mean,stddev,minormaxdirectly. For approximate percentiles, you need to provide them inXX%format, such as25%.