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
The ndarray data structure is quite Pythonic, so indexing works as expected. NumPy introduces some handy shortcuts and powerful indexing options. Fancy.
Learn more
A different solution
There are actually a couple of ways to add a new axis to your array other than wrapping it with brackets like this [fake_log]
.
Another popular solution is to use the np.newaxis
property. So the code would look something like this:
# Slice all the rows and add a new axis
fake_log[:, np.newaxis]
My Notes for Multidimensional Arrays
## Multidimensional Arrays
* The data structure is actually called `ndarray`, representing any **n**umber of **d**imensions
* Arrays can have multiple dimensions, you declare them on creation
* Dimensions help define what each element in the array represents. A two dimensional array is just an array of arrays
* **Rank** defines how many dimensions an array contains
* **Shape** defines the length of each of the array's dimensions
* Each dimension is also referred to as an **axis**, and they are zero-indexed. Multiples are called **axes**.
* A 2d array is AKA **matrix**.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
jun cheng wong
17,021 Points1 Answer
-
Jahmila Roberts
9,327 Points2 Answers
-
Than Win Hline
1,679 Points1 Answer
-
Than Win Hline
1,679 Points1 Answer
-
Caitlin Scouler
7,082 Points3 Answers
-
PLUS
MIAN OSAMA ARSHAD
Courses Plus Student 51 Points1 Answer
-
Muhammad Umar
7,906 Points1 Answer
-
PLUS
Stephen Cole
Courses Plus Student 15,810 Points1 Answer
-
PLUS
Siu KWAN Yuen
Courses Plus Student 2,898 Points1 Answer
-
Flore W
4,744 Points1 Answer
-
arash shabanpour
5,915 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