Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introduction to NumPy!
You have completed Introduction to NumPy!
Preview
You can create an array of booleans and then use that to index into your array. Let's use this to filter our values.
Learn more
My Notes for Indexing
## Creation
* You can create a random but bound grouping of values using the `np.random` package.
* `RandomState` lets you seed your randomness in a way that is repeatable.
* You can append a row in a couple of ways
* You can use the `np.append` method. Make sure the new row is the same shape.
* You can create/reassign a new array by including the existing array as part of the iterable in creation.
## Indexing
* You can use an indexing shortcut by separating dimensions with a comma.
* You can index using a `list` or `np.array`. Values will be pulled out at that specific index. This is known as fancy indexing.
* Resulting array shape matches the index array layout. Be careful to distinguish between the tuple shortcut and fancy indexing.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
We talked about creation and we saw a new
way to build a random grouping of numbers.
0:00
And we used RandomState to let us seed the
randomness in a way that was repeatable.
0:01
I have the same random values as you do.
0:05
That is super handy.
0:07
And we also learned that you can
append a row in a couple of ways.
0:09
There's even more that
we haven't seen here.
0:12
You can append, use the np.append method.
0:14
You need to make sure
that it's the same shape.
0:17
Remember we did that little hack
where we wrapped it in a list.
0:19
And you can create and
0:22
reassign a new array by including existing
arrays as part of the iterable right?
0:24
So you can throw the new
array in there and
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up