1/21
Flashcards for reviewing NumPy library concepts.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What does NumPy stand for?
'Numerical Python'
What is the core of NumPy?
The ndarray (n dimensions array), which is a grid of values of the same type indexed by a set of non-negative integers.
Which type of code is more concise and easier to read, vectorized code or code with explicit looping and indexing?
Vectorized code
What method is used to create an ndarray in NumPy?
numpy.array()
How to create an array filled only with zeros?
Use the method numpy.zeros()
How to create an array filled only with ones?
Use the method numpy.ones()
What does the 'shape' of an array represent?
The number of elements in each dimension.
What does reshaping an array mean?
Changing the shape of an array by adding or removing dimensions or changing the number of elements in each dimension.
When assigning a variable to an array, are we creating an array copy?
No, we are creating a memory pointer. To create a duplicate, we should use the method copy.
When we want to operate with an Array by rows or columns, which parameter should we use?
axis parameter. axis=0 for rows and axis=1 for columns
How to join a sequence of arrays?
Using the concatenate function.
How is stacking different from concatenation?
Stacking is done along a given axis.
True or False: Array variables are values.
False. Array variables are memory pointers.
How can a NumPy array be accessed and modified?
By indexing or slicing.
In NumPy, are loops normally necessary for searching a certain value in the array?
No, we have a method: where(condition)
What happens when operating with lists and NumPy arrays differently when operating with numbers?
When operating with lists, the operations affect the list and not its elements. When operating with NumPy arrays, the operations are element-wise.
What does the argsort function return?
The indices that would sort an array.
What does the argmax function return?
The index of the largest array element.
What does NumPy offer to work with random numbers?
A random module.
What are two different methods for creating random numbers in Random module?
Creating random integers or floats
How to get a Normal random data distribution?
Using the random.normal method.
Which function lets us pick elements at random?
The choice function.