Learn

Introduction to NumPy

Introduction to NumPy: Numerical Python

Sarah records her second-grade class’s grades in an online spreadsheet. Her web browser records that she visited that spreadsheet, in addition to every other site she’s visited. Those sites record her location, the time she spent on them, and where she visited next. The world is chock-full of all sorts of different datasets, and learning how to create, analyze, and manipulate these datasets can give us some insight and control over our digital surroundings.

In this lesson, we’ll be constructing and manipulating *single-variable* datasets. One way to think of a single-variable dataset is that it contains answers to a question. For instance, we might ask 100 people, “How tall are you?” Their heights in inches would form our dataset.

To work with our datasets, we’ll be using a powerful Python module known as *NumPy*, which stands for Numerical Python.

NumPy has many uses including:

- Efficiently working with many numbers at once
- Generating random numbers
- Performing many different numerical functions (i.e., calculating sin, cos, tan, mean, median, etc.)

In the following exercises, we’ll learn how to construct one- and two-dimensional arrays and perform basic array operations.

Examine the NumPy code displayed to the right in a Jupyter Notebook. These are some examples of what you will learn over the course of the lesson and how NumPy can be an incredibly useful and powerful tool. Don’t worry if you’re not sure how each piece of code works; this is just giving you an idea of what you can do with NumPy!

You can learn more about using Jupyter Notebooks here. We won’t be using Jupyter notebooks again in this lesson, but they are a great way of displaying data and explanations in an html-format.

When you’re ready, continue to the next exercise!