PythonMastery
beginner 14 min read · lesson 1 of 6 in Data Science Fundamentals

What is Data Science?

1 · The lesson

read

Data science is the work of getting knowledge out of data: turning raw rows and columns into decisions, predictions and findings that people will use. It uses statistics, machine learning and programming together, and it always starts from a question.

If you can write a Python for loop, you already have one small part of it. This lesson gives you an overview of the rest, before you use any NumPy.


1. The Working Definition

A data scientist takes a vague question, such as "why are users leaving?", "what price should we charge?" or "is this transaction fraud?", and answers it with evidence. The evidence comes from data. The answer is a number, a chart, a model or a recommendation.

Three ingredients show up every time:

  • A question that someone cares about.
  • Data that plausibly relates to the question.
  • A method (descriptive, statistical or predictive) that connects the two.

Without all three, it is not data science. A model with no question answers nothing useful. A question with no data can only be answered with a guess. Data and a question with no method give you only a feeling about the answer.


2. The Workflow Loop

Real projects go round in a loop, not in a straight line. The typical cycle:

text
       ┌─────────────┐
       │   1. Ask    │  define the question, the success metric
       └──────┬──────┘
              ▼
       ┌─────────────┐
       │  2. Get     │  load CSVs, query databases, scrape, call APIs
       └──────┬──────┘
              ▼
       ┌─────────────┐
       │  3. Clean   │  fix types, handle missing, dedupe
       └──────┬──────┘
              ▼
       ┌─────────────┐
       │  4. Explore │  plot, summarise, form hypotheses
       └──────┬──────┘
              ▼
       ┌─────────────┐
       │  5. Model   │  statistics, ML or simulation, if needed
       └──────┬──────┘
              ▼
       ┌─────────────┐
       │ 6. Communicate │  chart, deck, dashboard, PR
       └──────┬──────┘
              │
              └──► back to 1 with sharper questions

Beginners often spend most of their time on steps 2-4 and forget how much of the value comes from steps 1 and 6. A correct model that nobody reads changes nothing.


3. DS vs Data Engineering vs ML vs Analytics

These titles overlap and every company defines them differently. A rough map:

RoleMain outputMain toolsTypical timescale
Data AnalystDashboards, reports, ad-hoc answersSQL, Excel, BI toolsDays
Data ScientistModels, experiments, decisionsPython, stats, MLWeeks
ML EngineerProduction models in servicesPython, Docker, MLOpsMonths
Data EngineerPipelines, warehouses, tablesSQL, Spark, AirflowQuarters

A "full-stack" data scientist does parts of all four jobs. At a small company, that is normal. At a big one, you specialise.


4. A Day in the Life

A typical day for a data scientist:

  • Morning: open a Jupyter notebook, run a SQL query against the data warehouse, look over the results, ask the PM a clarifying question on Slack.
  • Mid-morning: clean the data, make three plots, notice something strange in one category, and investigate it.
  • Afternoon: fit a baseline model, usually a simple one like logistic regression, to see if the data can predict anything at all.
  • Late afternoon: write up the finding in a doc with one chart and three bullet points. Push to GitHub.
  • Following day: work on the new questions that the write-up raised.

Notice what is not on the list: dramatic ML breakthroughs, six-monitor setups, coding puzzles. Most of the work is looking at data patiently.


5. The Python Data Science Stack

You'll meet these in roughly this order across the next five lessons:

LibraryWhat it doesWhen you use it
NumPyFast numeric arraysAny maths on numbers
pandasLabelled tables (DataFrames)Loading, cleaning, grouping CSVs
matplotlib / seabornStatic chartsExploring and communicating
scikit-learnClassical ML: regression, trees, clusteringPredictive modelling
statsmodelsStatistical models with full diagnosticsInference, hypothesis testing
PyTorch / TensorFlowDeep learningImages, text, audio

Other tools you will hear about, such as Plotly, Polars, PySpark, XGBoost and LangChain, are alternatives or specialised tools. Most of them work in a similar way to the libraries above, so once you know this short list, the others are much easier to learn.


6. A Tiny First Example: No NumPy Required

Even without any extra library, the standard library can calculate useful summaries. The statistics module comes with Python:

python
import statistics

monthly_sales = {
    "Jan": 12_400,
    "Feb": 9_800,
    "Mar": 15_200,
    "Apr": 11_700,
    "May": 18_900,
}

values = list(monthly_sales.values())

print(f"Mean:   {statistics.mean(values):.0f}")        # 13600
print(f"Median: {statistics.median(values):.0f}")      # 12400
print(f"Stdev:  {statistics.stdev(values):.0f}")       # 3540
print(f"Max:    {max(values)}  ({max(monthly_sales, key=monthly_sales.get)})")
print(f"Min:    {min(values)}  ({min(monthly_sales, key=monthly_sales.get)})")

This is data science on a very small scale: a dataset, a question ("how is each month doing?"), a method (summary statistics) and an answer you can explain. You'll move on to NumPy and pandas in the next lessons, but the way of thinking stays the same.


Common Mistakes

  • Jumping to ML before exploring the data. A simple plot answers many business questions. Train a model only when looking at the data isn't enough.
  • Treating DS as just programming. Clean code without an understanding of the subject still produces wrong answers. Always learn the business context.
  • Skipping step 1. "Build me a churn model" is not a question. "Which signals predict churn within 30 days for users on the free tier?" is. Make the question precise before you start.
  • Learning too many tools at once. You don't need to know Spark, Airflow, dbt, and three vector databases on day one. NumPy + pandas + matplotlib covers most of the job.
  • Confusing correlation with causation. Two columns moving together does not mean one drives the other. Use statistics before you claim that "X causes Y".

🎯 Your Turn: Build a summarise() Function

Write a function that takes a list of numbers and returns the five summary statistics that data scientists calculate all the time. Use only the standard library, no NumPy yet.

Skeleton:

python
import statistics

def summarise(data):
    """Return {mean, median, min, max, std} for a list of numbers."""
    # TODO 1: handle an empty list (return None or raise an error)
    # TODO 2: build and return the dict
    ...

# Test
print(summarise([4, 8, 15, 16, 23, 42]))
# Expected: {'mean': 18, 'median': 15.5, 'min': 4, 'max': 42, 'std': 13.49}
Hint 1: Which functions? The statistics module has mean, median, and stdev. Min and max are Python built-ins. Round the float values to keep your output readable.
Hint 2: Edge cases statistics.stdev needs at least 2 values and raises StatisticsError on shorter lists. Decide what your function does for 0 or 1 elements. Returning None or an empty dict is fine for now.
Show full solution
python
import statistics

def summarise(data):
    """Return {mean, median, min, max, std} for a list of numbers."""
    if not data:
        return None
    return {
        "mean":   round(statistics.mean(data), 2),
        "median": statistics.median(data),
        "min":    min(data),
        "max":    max(data),
        "std":    round(statistics.stdev(data), 2) if len(data) > 1 else 0.0,
    }

print(summarise([4, 8, 15, 16, 23, 42]))
# {'mean': 18, 'median': 15.5, 'min': 4, 'max': 42, 'std': 13.49}

print(summarise([]))     # None
print(summarise([7]))    # {'mean': 7, 'median': 7, 'min': 7, 'max': 7, 'std': 0.0}

You've just written your first reusable EDA helper. In a few lessons, pandas will give you .describe(), which does this for you, and you won't need this function. That's fine. You wrote this version so that you know what .describe() calculates.


What You Learned

  • Data science needs a question, data and a method. Without one of them, it isn't data science.
  • The workflow is a loop: ask → get → clean → explore → model → communicate → repeat.
  • Data scientists, analysts, ML engineers and data engineers overlap, but they produce different outputs on different timescales.
  • The main Python libraries are NumPy, pandas, matplotlib and scikit-learn, with deep learning libraries on top.
  • Even before any library, the standard library's statistics module can calculate basic summaries.

Next: Python for Data Analysis: the Python idioms and standard-library tools that are most useful for this work.

Found this useful? Share it with a friend who’s learning Python.