Python Libraries and modules - NumPy

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/21

flashcard set

Earn XP

Description and Tags

Flashcards for reviewing NumPy library concepts.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

22 Terms

1
New cards

What does NumPy stand for?

'Numerical Python'

2
New cards

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.

3
New cards

Which type of code is more concise and easier to read, vectorized code or code with explicit looping and indexing?

Vectorized code

4
New cards

What method is used to create an ndarray in NumPy?

numpy.array()

5
New cards

How to create an array filled only with zeros?

Use the method numpy.zeros()

6
New cards

How to create an array filled only with ones?

Use the method numpy.ones()

7
New cards

What does the 'shape' of an array represent?

The number of elements in each dimension.

8
New cards

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.

9
New cards

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.

10
New cards

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

11
New cards

How to join a sequence of arrays?

Using the concatenate function.

12
New cards

How is stacking different from concatenation?

Stacking is done along a given axis.

13
New cards

True or False: Array variables are values.

False. Array variables are memory pointers.

14
New cards

How can a NumPy array be accessed and modified?

By indexing or slicing.

15
New cards

In NumPy, are loops normally necessary for searching a certain value in the array?

No, we have a method: where(condition)

16
New cards

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.

17
New cards

What does the argsort function return?

The indices that would sort an array.

18
New cards

What does the argmax function return?

The index of the largest array element.

19
New cards

What does NumPy offer to work with random numbers?

A random module.

20
New cards

What are two different methods for creating random numbers in Random module?

Creating random integers or floats

21
New cards

How to get a Normal random data distribution?

Using the random.normal method.

22
New cards

Which function lets us pick elements at random?

The choice function.