1. Home
  2. Explore
  3. Statistics
  4. Descriptive Statistics and EDA

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Descriptive Statistics and EDA

Descriptive Statistics and Exploratory Data Analysis

Descriptive statistics and exploratory data analysis provide the first structured understanding of a dataset. They help an analyst summarize the data, detect unusual or incorrect values, identify patterns, and formulate questions for deeper investigation.


1. Purpose of Descriptive Statistics

Descriptive statistics summarize the main characteristics of a dataset using simple mathematical calculations. They are usually performed after the data has been cleaned of obvious problems such as duplicate records and missing values.

Descriptive analysis helps an analyst determine:

  • What the data looks like overall

  • What values are typical

  • The minimum and maximum values

  • Whether values are spread out or concentrated

  • Whether unusual or potentially incorrect observations exist

  • Which areas require further investigation

The initial descriptive analysis does not usually explain why a pattern exists. Instead, it provides a foundation for asking more detailed questions and conducting exploratory analysis.

Common descriptive measures

The main measures introduced are:

  • Mean: The arithmetic average

  • Median: The central value after the data is ordered

  • Minimum: The smallest value in the dataset

  • Maximum: The largest value in the dataset

These measures provide a quick overview of numerical data. For example, analyzing taxi fares can reveal the typical fare, the lowest fare, and the highest fare.


2. Outliers and Anomalous Values

An outlier is a data point that falls outside the normal range of the rest of the data. Outliers may represent genuine unusual events, but they can also indicate data-entry errors, measurement problems, or other issues that were not detected during the initial cleaning process.

An outlier is an observation that lies unusually far from the general pattern or normal range of a dataset.

Example of an outlier

Suppose the heights of a group of people are generally between 6 and 7 feet. A recorded height of 10 feet would be highly unusual and would probably indicate an error.

This value is an outlier because it does not fit the expected range of the data.

Why outliers matter

Outliers can:

  • Distort the mean

  • Make the data appear more spread out than it really is

  • Reveal incorrect or impossible values

  • Affect later statistical calculations

  • Point to unusual behavior that may be important to investigate

Outliers should not automatically be deleted. An analyst should first determine whether the value is:

  • A data-entry or measurement error

  • An impossible value

  • A genuine but unusual observation

  • Relevant to the business question

In the taxi dataset, a negative fare was clearly suspicious because a passenger normally should not pay a negative amount.


3. Mean, Median, Minimum, and Maximum

Mean

The mean, or arithmetic average, is calculated by adding all values and dividing by the number of values.

Mean=sum of all valuesnumber of values\text{Mean} = \frac{\text{sum of all values}}{\text{number of values}}Mean=number of valuessum of all values​

For values x1,x2,…,xnx_1, x_2, \ldots, x_nx1​,x2​,…,xn​, the mean is:

xˉ=x1+x2+⋯+xnn\bar{x} = \frac{x_1+x_2+\cdots+x_n}{n}xˉ=nx1​+x2​+⋯+xn​​

The mean is useful for summarizing the overall level of a variable. However, it is sensitive to extreme values. A very large or very small observation can pull the mean away from what is typical for most records.

Median

The median is the central value after all observations have been arranged in numerical order.

  • If there is an odd number of observations, the median is the middle value.

  • If there is an even number of observations, the median is typically the average of the two middle values.

The median is less affected by extreme values than the mean. It can therefore provide a better representation of a typical observation when the data contains outliers or is highly skewed.

Minimum

The minimum is the smallest value in the dataset. It can reveal:

  • The lowest legitimate observation

  • Impossible values

  • Negative values where they should not occur

  • Potential data-entry errors

Maximum

The maximum is the largest value in the dataset. It can reveal:

  • The highest observed value

  • Unusually large observations

  • Potential outliers

  • The overall upper range of the data

Mean versus median

The mean and median can be compared to assess whether extreme values may be influencing the data.

  • If the mean and median are close, the data may be relatively balanced.

  • If the mean is much higher than the median, unusually large values may be increasing the average.

  • If the mean is much lower than the median, unusually small values may be affecting the average.

For the taxi fare data, the median fare was approximately 9.5. This suggested that the typical fare was around that amount, even though some fares were much lower or higher.


4. Calculating Descriptive Statistics in a Spreadsheet

A separate worksheet should be created for descriptive statistics so that the summary calculations remain separate from the raw data.

Setting up a summary worksheet

A typical setup includes:

  • A column identifying the statistic

  • A column identifying the variable being analyzed

  • Rows for the mean, median, minimum, and maximum

For example, the worksheet could contain:

  • Statistic

  • Fare amount

  • Mean

  • Median

  • Minimum

  • Maximum

The labels do not need to match the raw dataset exactly, but they should clearly represent the information being summarized.

Spreadsheet functions

Spreadsheet applications can calculate descriptive measures with functions such as:

  • AVERAGE

  • MEDIAN

  • MIN

  • MAX

A formula generally begins with an equals sign. To calculate a statistic from another worksheet, the analyst selects the relevant column or range from the original data sheet.

The general process is:

  1. Select the cell where the result should appear.

  2. Begin a formula with an equals sign.

  3. Enter the appropriate statistical function.

  4. Select the relevant column or range from the raw-data worksheet.

  5. Close the formula and confirm it.

  6. Repeat the process for the remaining measures.

The same process can be used with any numerical column, not only fare amount.


5. Detecting and Correcting Invalid Fare Values

When the minimum fare was calculated, the result included a negative amount of approximately negative 2.43. A negative taxi fare is not logically valid in this context and indicates a problem in the dataset.

This illustrates an important benefit of descriptive analysis:

Simple summary calculations can reveal data-quality problems that remain after duplicates and missing values have been removed.

Why calculating only one suspicious value is insufficient

Finding one negative fare does not guarantee that it is the only invalid record. Other negative values may also exist elsewhere in the dataset. Therefore, the analyst must identify all records that violate the expected rules.

Sorting the data to find invalid values

Sorting the fare column in ascending order places the smallest values first.

The process is:

  1. Select the complete dataset or relevant data range.

  2. Open the data-sorting options.

  3. Indicate that the first row contains headers.

  4. Select the fare column as the sorting field.

  5. Sort from lowest to highest.

  6. Examine the records at the top of the sorted dataset.

  7. Identify all negative fare values.

  8. Select the corresponding complete rows.

  9. Delete the invalid records if they are confirmed to be errors.

  10. Recalculate the descriptive statistics.

Sorting is effective because all negative values appear together at the beginning of the ordered data.

Zero fares

The sorted data also contained many fares equal to zero. These values may or may not be errors.

The analyst must decide whether zero-fare records should be retained based on the context. Possible explanations include:

  • A free ride

  • A promotional trip

  • A data-recording issue

  • A canceled or incomplete trip

  • A special service arrangement

Unlike negative fares, zero fares are not automatically invalid. They require contextual judgment.

Rechecking the summary

After deleting confirmed negative fares, the minimum value should be recalculated. The updated minimum provides a check that the invalid values have been removed and gives a more meaningful description of the remaining fare data.


6. Exploratory Data Analysis

Exploratory data analysis, or EDA, is the process of investigating a dataset to discover patterns, relationships, unusual observations, and potentially useful insights.

Descriptive statistics are one part of EDA. EDA goes further by examining relationships between variables and organizing data in ways that help answer practical questions.

Main goals of EDA

EDA helps an analyst:

  • Understand the structure of the data

  • Identify important variables

  • Discover patterns and trends

  • Compare groups

  • Detect unusual or inconsistent records

  • Investigate relationships between variables

  • Generate questions for further analysis

  • Produce evidence relevant to a business problem

EDA is not simply a mechanical process of calculating every available statistic. The analyst must first decide what questions are meaningful.


7. Defining Business and Analytical Questions

Before performing extensive analysis, an analyst should identify the questions that the data needs to answer.

Defining the questions is as important as calculating the answers.

The questions should relate to the business purpose of the analysis. For a taxi service, useful questions might include:

  • Which pickup locations are used most frequently?

  • Which locations receive the most trips?

  • What distance do passengers typically travel?

  • Is passenger count related to trip distance?

  • What payment methods are most common?

  • Is payment method related to the taxi vendor?

  • Are certain vendors associated with particular payment types?

  • Are some pickup and drop-off locations connected more frequently than others?

Clearly defining these questions helps determine:

  • Which columns to analyze

  • Which summary measure to use

  • How to group the data

  • Whether to compare rows, columns, or both

  • Which results may be important to the business


8. Four Key Questions in the Taxi Dataset

The exploratory analysis focused on four questions.

8.1 Pickup location frequency

The first question was:

How many taxi rides began at each pickup location?

This identifies the most frequently used pickup locations. It can help reveal:

  • Busy transportation areas

  • Popular neighborhoods

  • Major travel hubs

  • Locations that may require more taxi availability

8.2 Passenger count and trip distance

The second question was:

Is there a relationship between the number of passengers and the distance traveled?

This comparison can reveal whether trips with more passengers tend to be longer, shorter, or similar in distance to trips with fewer passengers.

The analysis groups records by passenger count and calculates the average trip distance for each group.

8.3 Payment-type statistics

The third question was:

Which payment methods do passengers use, and how often is each method used?

This provides a frequency distribution of payment types. It may help a business understand:

  • Customer payment preferences

  • The relative use of cash and electronic payment methods

  • Whether payment infrastructure supports customer behavior

  • Which payment categories dominate the dataset

8.4 Payment type and vendor ID

The fourth question was:

Is payment type related to taxi vendor?

This requires comparing two categorical variables at the same time:

  • Payment type

  • Vendor ID

The results show the number of records for each combination of payment type and vendor. This can reveal whether certain payment methods are used more often with one vendor than another.


9. Pivot Tables

A pivot table is a spreadsheet tool that summarizes and reorganizes data according to selected categories. It can group records and calculate values such as:

  • Counts

  • Sums

  • Averages

  • Minimums

  • Maximums

Pivot tables are especially useful when an analyst needs to compare categories or investigate relationships between variables.

Why pivot tables are useful

Pivot tables help analysts:

  • Group records by meaningful categories

  • Count how often categories occur

  • Calculate averages for each group

  • Compare two variables

  • Produce concise summaries without manually writing many formulas

  • Quickly change the arrangement of an analysis

A pivot table usually contains four main areas:

  • Rows: The categories displayed vertically

  • Columns: The categories displayed horizontally

  • Values: The numerical calculation being performed

  • Filters: Optional conditions used to limit the records included


10. Creating a Pickup-Location Frequency Pivot Table

To determine how often each pickup location was used, the pickup location is used as both the grouping category and the counted value.

Configuration

  • Rows: Pickup location

  • Values: Pickup location ID

  • Summarization: Count

The resulting table lists each pickup location and the number of rides that began there.

For example, one location may have been used five times, while another may have been used seven times. In the dataset, pickup location 237 was the most frequent, with approximately 4,192 rides beginning there.

General process

  1. Open the insert menu.

  2. Select the pivot-table option.

  3. Choose to place the pivot table on a new worksheet.

  4. Add pickup location to the Rows area.

  5. Add pickup location ID to the Values area.

  6. Set the value calculation to Count.

  7. Review the resulting frequencies.

Copying results to a separate worksheet

After creating the pivot table, the results should be copied into a separate worksheet for analysis.

This protects the analysis from accidental changes to the pivot table and allows the pivot table to be reused for other questions.

When copying the results:

  • Copy only the required values.

  • Avoid copying formulas or links when an independent dataset is needed.

  • Give the new worksheet clear column names, such as pickup location and frequency.

Sorting by frequency

To identify the most popular locations:

  1. Select the copied pickup-location data.

  2. Open the sorting options.

  3. Specify that the data contains headers.

  4. Sort by frequency.

  5. Choose descending order so that the highest counts appear first.

This produces a ranked list of pickup locations, with the busiest locations at the top.


11. Comparing Passenger Count and Trip Distance

The second pivot-table analysis examined whether the number of passengers was associated with the average trip distance.

Configuration

  • Rows: Passenger count

  • Values: Trip distance

  • Summarization: Average

This groups trips by passenger count and calculates the average distance for each group.

The passenger-count categories ranged from zero to six passengers in the dataset. The resulting summary shows the typical trip distance for each passenger-count group.

Interpretation

This analysis can help determine whether:

  • Larger passenger groups take longer trips

  • Smaller groups tend to travel farther

  • Trip distance is relatively consistent across passenger counts

  • Some passenger-count categories behave differently from the rest

The pivot table does not, by itself, prove that passenger count causes trip distance to change. It provides a descriptive comparison that may support further investigation.


12. Analyzing Payment-Type Frequencies

The third analysis measured how often each payment type occurred.

Configuration

  • Rows: Payment type

  • Values: Payment type

  • Summarization: Count

The resulting pivot table lists each payment category and the number of trips associated with it.

Purpose

Payment-frequency analysis can reveal:

  • The most common payment method

  • Less frequently used payment options

  • Whether customers primarily use cash or electronic payments

  • Whether a payment category is rare enough to require additional investigation

As with the other analyses, the results should be copied to a separate worksheet if they will be sorted, formatted, or used for further analysis.


13. Comparing Payment Type and Vendor ID

The fourth analysis compared payment type with vendor ID. This differs from the previous analyses because it examines two categorical variables simultaneously.

Configuration

  • Rows: Payment type

  • Columns: Vendor ID

  • Values: Payment type or vendor ID

  • Summarization: Count

Counting either payment type or vendor ID produces the same number of records for each combination, provided that the counted field is present for every relevant record.

Interpreting the table

The resulting table contains:

  • One row for each payment type

  • One column for each vendor

  • A count in each cell representing the number of trips with that payment type and vendor combination

The table can reveal whether certain payment types are concentrated among particular vendors.

In the dataset, vendor number 2 had no records for payment types 3 and 4. This means that, within the analyzed data, vendor 2 was not associated with those payment categories.

A blank or zero cell does not necessarily mean that the payment type is impossible for that vendor. It means that no such records appeared in the dataset being analyzed.


14. Recommended Analysis Workflow

A practical workflow for descriptive and exploratory analysis is:

  1. Begin with cleaned data.

    • Remove or address duplicates and missing values.

    • Confirm that the dataset is ready for analysis.

  2. Create a separate analysis worksheet.

    • Keep summary calculations separate from raw records.

    • Use clear and representative labels.

  3. Calculate basic descriptive statistics.

    • Mean

    • Median

    • Minimum

    • Maximum

  4. Inspect suspicious results.

    • Look for impossible values.

    • Compare the minimum and maximum with domain expectations.

    • Investigate unusually large differences between mean and median.

  5. Correct confirmed data-quality problems.

    • Filter or sort the raw data.

    • Remove clearly invalid records.

    • Recalculate the statistics afterward.

  6. Define meaningful analytical questions.

    • Connect questions to business needs.

    • Decide which variables are relevant.

  7. Use pivot tables to summarize groups.

    • Use rows for categories.

    • Use columns when comparing two categorical variables.

    • Use values for counts or numerical summaries.

  8. Copy important results into independent worksheets.

    • Preserve the pivot table for additional analyses.

    • Avoid unintended links between worksheets.

  9. Sort and rank results.

    • Use descending order to identify the most frequent or largest values.

    • Use ascending order to find the smallest or potentially invalid values.

  10. Interpret the findings carefully.

    • Distinguish descriptive patterns from causal conclusions.

      • Consider the context of the data before making decisions.


15. Key Takeaways

Descriptive statistics provide the first overview of a dataset by summarizing its center and range.

Outliers fall outside the normal range and may indicate errors, unusual events, or important patterns.

The mean is sensitive to extreme values, while the median is generally more resistant to them.

Minimum and maximum values are useful for detecting impossible or suspicious observations.

Exploratory data analysis uses summaries, comparisons, and grouping techniques to discover patterns and relationships.

Pivot tables efficiently group data and calculate counts, averages, minimums, and maximums.

The combination of descriptive statistics and exploratory data analysis allows an analyst to understand the structure of the data, identify remaining data-quality problems, and answer practical questions before moving on to visualization or more advanced analysis.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent