NumPy Arrays
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

At this point in the course, we've already covered a pretty good chunk of NumPy's preprocessing library. We've gone through standardization and min/max scaling, normalization and we dabbled with imputation when we used the simple imputer function. But now we're going to shift gears a little bit and take a deep dive into everything related to the NumPy array.

Let's start this by making a two-by-10 matrix. And the first 10 elements are all integers from zero to nine. And the last 10 elements are from 10 to 19. Now, let's run this and move into the console. Then pass in type, followed by parentheses and finally, the array object.

medium

medium

If you haven't used Python's type method, it works by returning the object class, which in this case, is NumPy's ndarray. And the ndarray is what we'll be spending the next few guides exploring. But as a quick introduction, I'll show you the exact documentation but essentially, an ndarray acts as a container object, which means it's an object that's specifically made to hold other objects.

There's really only two primary objects that an ndarray is designed to contain. The first is what we're most familiar with and that's the actual array object. The second is an associated data type object or a dtype for short. And that describes the format of each element in the array.

In the next guide, we'll be taking a high-level approach towards data type objects but even further out than that, we'll also be covering different ways of changing data types, the internal memory layout of an array, processing cycles, and a little bit more on missing data and placeholders. And we'll finish with some array methods for shape manipulation.

So with all that being said, I'm going to wrap this guide up and I'll see you in the next one.