## Key Concepts

Review core concepts you need to learn to master this subject

### NumPy Arrays

``````# Import the NumPy module, aliased as 'np'
import numpy as np

# NumPy Arrays can be created with a list
my_array = np.array([1, 2, 3, 4])``````

NumPy (short for “Numerical Python”) is a Python module used for numerical computing, creating arrays and matrices, and performing very fast operations on those data structures. The core of NumPy is a multidimensional Array object.

The NumPy `.array()` method is used to create new NumPy Arrays.

Introduction to NumPy
Lesson 1 of 1
1. 1
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…
2. 2
To use NumPy with Python, import it at the top of your file using the following line: import numpy as np Writing as np allows us to use np as a shorthand for NumPy, which saves us time when cal…
3. 3
NumPy includes a powerful data structure known as an array. A NumPy array is a special type of list. It’s a data structure that organizes multiple items. Each item can be of any type (strings, …
4. 4
Typically, you won’t be entering data directly into an array. Instead, you’ll be importing the data from somewhere else. We’re able to transform CSV (comma-separated values) files into arrays usin…
5. 5
Generally, NumPy arrays are more efficient than lists. One reason is that they allow you to do element-wise operations. An element-wise operation allows you to quickly perform an operation, such …
6. 6
Arrays can also be added to or subtracted from each other in NumPy, assuming the arrays have the same number of elements. When adding or subtracting arrays in NumPy, each element will be added/sub…
7. 7
In Python, we can create lists that are made up of other lists. Similarly, in NumPy we can create an array of arrays. If the arrays that make up our bigger array are all the same size, then it has …
8. 8
NumPy allows us to select elements from an array using their indices. Consider the one-dimensional array a = np.array([5, 2, 7, 0, 11]) If we wanted to select the first element in this array, we…
9. 9
Selecting elements from a 2-d array is very similar to selecting them from a 1-d array, we just have two indices to select from. The syntax for selecting from a 2-d array is a[row,column] where a i…
10. 10
Another useful thing that arrays can do is perform element-wise logical operations. For instance, suppose we want to know how many elements in an array are greater than 5. We can easily write som…
11. 11
Let’s take a second and review. In this lesson, you learned the basics of the NumPy package. Here are some key points: - Arrays are a special type of list that allows us to store values in an orga…

## What you'll create

Portfolio projects that showcase your new skills

## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory