Getting Started With Python’s NumPy
Learn How To Use One of Data Science’s Favorite Libraries
If you’re using Python for data science or machine learning, you won’t get far without NumPy. It’s the backbone of a number of other libraries that you’ll likely need, so learning how it works now will help you understand the higher level ideas later on.
By the way, it’s pronounced “NUM-pie” not “numpee” just in case you haven’t heard it out loud.
Getting Started
Install NumPy with pip and then import it into your file with an alias:
import numpy as np
You’ll use it a lot and believe me, it get’s annoying even typing np
. Also, for this article I’m going to assume a basic fluency in Python, since I want to keep this focused on NumPy. However, here’s a hot tip for all those JS devs out there: remember you can use Nodemon to rerun.py
files on save!
nodemon numpy-practice.py
# This works!
What does NumPy do?
Primarily, it gives us access to better lists called “arrays.” These NumPy arrays are super fast. There’s just no comparison between NumPy arrays and Python lists when it comes to serious data analysis. But more important than speed is that these arrays give…