Week 1

Numpy arrays

Note: Vectorized operations on numpy arrays are much faster than Python loops:

Indexing and slicing

Indexing

Slicing

Note: Changing an array slice will change the original array.

This is different than list slicing:

Create a copy of a slice to keep the original array unchanged:

Arrays and matplotlib

Multidimensional arrays

Multidimensional indexing and slicing

Slicing illustration

Boolean indexing

Fancy indexing

Aggregations

Sorting

Example

Broadcasting