Introduction to NumPy
In the Python Fundamentals course and the Python Intermediate course, you learned the fundamentals of Python programming. Now that you have a good foundation of the Python programming language, it’s time to start working with libraries, which you can think of as a bit like plugins for a browser: they’re bits of code you can import when you’re working with Python to unlock new functionality and make your own code more powerful.
We’ll start with one of the most powerful Python libraries for working with data: NumPy.
Why NumPy? One of the reasons that the Python language is extremely popular is that it makes writing programs easy. Because Python is a high-level language, you don’t have to worry about things like allocating memory on your computer or choosing how certain operations are done by your computer’s processor. In contrast, when you use low-level languages like C, you define exactly how memory will be managed and how the processor will execute your instructions. This means that coding in a low-level language takes longer; however, you have more ability to optimize your code to run faster.
When choosing between a high- and low-level language, you make a trade-off between being able to work quickly, and creating programs that run quickly and efficiently. Luckily, there are two Python libraries that give us the best of both worlds: NumPy and pandas. Together, pandas and NumPy provide a powerful toolset for working with data in Python because they allow us to write code quickly without sacrificing performance.
We’ll introduce pandas in more detail later in future lessons, but first, you’ll learn about NumPy and its fundamental concepts, such as ndarrays and vectorization. It’s features like these that make Python one of the most popular programming languages for data science. Aside from learning about ndarrays and vectorization, you’ll also learn how to calculate statistics for ndarrays, vector math, and more.
As you learn, you’ll analyze real-world data sets, starting with New York City taxi trip data.
- Learn how vectorized operations make your code faster.
- Learn how to select data from NumPy ndarrays.
- Learn how to analyze data using NumPy methods.
- Understanding Vectorization
- NYC Taxi-Airport Data
- Array Shapes
- Selecting and Slicing Rows and Items from ndarrays
- Selecting Columns and Custom Slicing ndarrays
- Vector Math
- Vector Math Continued
- Calculating Statistics For 1D ndarrays
- 10.. Calculating Statistics For 1D ndarrays Continued
- Calculating Statistics For 2D ndarrays
- Next Steps