Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Let's take a look at a detailed example that uses the new array programming paradigm. We'll have NumPy do some linear algebra for us!
Code
orders = np.array([
[2, 0, 0, 0],
[4, 1, 2, 2],
[0, 1, 0, 1],
[6, 0, 1, 2]
])
totals = np.array([3, 20.50, 10, 14.25])
Learn More
- Build a Learning Mindset
- Wikipedia - Array Programming
- Khan Academy - Linear Algebra <== Wonderful courses
- NumPy also has a
matrix
datatype. This is for historical reasons. Learn more about array vs. matrix
My Notes from Manipulation
## Array Manipulation
* The documentation on [Array Manipulation](https://docs.scipy.org/doc/numpy/reference/routines.array-manipulation.html) is a good one to keep bookmarked.
* `ndarray.reshape` creates a view with a new shape
* You can use `-1` as a value to infer the missing dimension
* `ndarray.ravel` returns a single dimensional view of the array.
* `ndarray.flatten` can be used to make a single dimensional copy.
* `np.lookfor` is great for searching docstrings from within a notebook.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Nicole Buckenwolf
8,721 Points1 Answer
-
yige yang
8,329 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
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