liveBook · Manning

Descriptive statistics

As explained in Statistics Every Programmer Needs

Descriptive statistics are methods for summarizing and presenting the main characteristics of observed data.

Descriptive statistics summarize observed data so analysts can quickly inspect central tendency, spread, range, and distribution before deeper investigation. Continuous data commonly uses mean, median, standard deviation, and range; categorical data uses frequency counts and proportions. section 1.1.4

Use descriptive statistics to:

GM closing prices

Applying pandas describe() to GM closing prices shows that July–December 2023 averaged $32.93 with a standard deviation of $3.65 and a range of $26.43–$40.05, while January 2024 averaged $35.46 with a standard deviation of $0.81 and a range of $34.39–$37.94. The comparison identifies greater stability in January and supplies historical context for Monte Carlo simulation. section 9.5.2

>>> all_simulations = \
>>>     simulation_df.values.flatten()   #1
>>> overall_stats = pd.DataFrame(all_simulations, 
>>>         columns = ['Simulated Prices']).describe() #2
>>> print(overall_stats)     #3
       Simulated Prices
count      10500.000000
mean          35.559536
std            2.204029
min           25.996207
25%           34.261598
50%           35.691632
75%           36.821081
max           47.983021

Flatten simulated prices and use DataFrame.describe() to calculate count, mean, standard deviation, quartiles, minimum, and maximum. section 9.5.8

How Statistics Every Programmer Needs covers it

How deep it goes
Defines core metrics and demonstrates pandas summaries, but stops short of inferential formulas, uncertainty quantification, or formal assumptions.
Examples
Uses categorical counts, GM historical closing prices, and flattened simulated stock-price distributions.
What it assumes
Assumes an observed dataset and distinguishes continuous from categorical values while introducing suitable summary measures.
What you can do after
Apply it via pandas DataFrame.describe() to summarize distributions and compare observed with simulated data.
How it connects
Connects descriptive statistics with inferential statistics, probability, regression analysis, and Monte Carlo simulation.

Also explained in

Compare how 6 books explain descriptive statistics →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.