Skip to main content

Introduction to NumPy

Learn how to use NumPy arrays in Python to perform mathematical operations and wrangle data with the best of them!

Start Course for Free
4 Hours13 Videos49 Exercises2,621 Learners4250 XP

Create Your Free Account



By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA. You confirm you are at least 16 years old (13 if you are an authorized Classrooms user).

Loved by learners at thousands of companies

Course Description

NumPy is an essential Python library. TensorFlow and scikit-learn use NumPy arrays as inputs, and pandas and Matplotlib are built on top of NumPy. In this Introduction to NumPy course, you'll become a master wrangler of NumPy's core object: arrays! Using data from New York City's tree census, you'll create, sort, filter, and update arrays. You'll discover why NumPy is so efficient and use broadcasting and vectorization to make your NumPy code even faster. By the end of the course, you'll be using 3D arrays to alter a Claude Monet painting, and you'll understand why such array alterations are essential tools for machine learning.

  1. 1

    Understanding NumPy Arrays


    Meet the incredible NumPy array! Learn how to create and change array shapes to suit your needs. Finally, discover NumPy's many data types and how they contribute to speedy array operations.

    Play Chapter Now
    Introducing arrays
    50 xp
    Your first NumPy array
    100 xp
    Creating arrays from scratch
    100 xp
    A range array
    100 xp
    Array dimensionality
    50 xp
    3D array creation
    100 xp
    The fourth dimension
    100 xp
    Flattening and reshaping
    100 xp
    NumPy data types
    50 xp
    The dtype argument
    100 xp
    Anticipating data types
    100 xp
    A smaller sudoku game
    100 xp
  2. 2

    Selecting and Updating Data

    Sharpen your NumPy data wrangling skills by slicing, filtering, and sorting New York City’s tree census data. Create new arrays by pulling data based on conditional statements, and add and remove data along any dimension to suit your purpose. Along the way, you’ll learn the shape and dimension compatibility principles to prepare for super-fast array math.

    Play Chapter Now
  3. 3

    Array Mathematics!

    Leverage NumPy’s speedy vectorized operations to gather summary insights on sales data for American liquor stores, restaurants, and department stores. Vectorize Python functions for use in your NumPy code. Finally, use broadcasting logic to perform mathematical operations between arrays of different sizes.

    Play Chapter Now
  4. 4

    Array Transformations

    NumPy meets the art world in this final chapter as we use image data from a Monet masterpiece to explore how you can use to augment image data. You’ll use flipping and transposing functionality to quickly transform our masterpiece. Next, you’ll pull the Monet array apart, make changes, and reconstruct it using array stacking to see the results.

    Play Chapter Now


Monet RGB ArrayTree Census ArrayMonthly Sales ArraySudoku Game ArraySudoku Solution Array


james-datacampJames Chapmanamy-4121b590-cc52-442a-9779-03eb58089e08Amy Peterson


Intermediate Python
Izzy Weber Headshot

Izzy Weber

Curriculum Manager, DataCamp

Izzy is a Curriculum Manager at DataCamp. She discovered a love for data during her seven years as an accounting professor at the University of Washington. She holds a masters degree in taxation and is a Certified Public Accountant. Her passion is making learning technical topics fun for students.
See More

What do other learners have to say?

I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.

Devon Edwards Joseph
Lloyds Banking Group

DataCamp is the top resource I recommend for learning data science.

Louis Maiden
Harvard Business School

DataCamp is by far my favorite website to learn from.

Ronald Bowers
Decision Science Analytics, USAA