Python NumPy 1 Getting started Flashcards

1
Q

What does NumPy add to Python?

A

The ability to work with large arrays, do computation with vectors, and do matrix algebra.

Mathematical operations can be performed on all values in a ndarray at one time rather than having to loop through values, as would be necessary with a Python list.
NumPy is very fast .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

If you have the Anaconda distribution, how do you install the NumPy library?

A

Get into the Anaconda prompt, and type
>conda install numpy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What new object types does NumPy introduce?

A

ndarray = arrays = multidimensional arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If you want to use the NumPy library, what must you first do in your session.

A

Import numpy as np

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the types operations that we will learn about arrays?

A

How to create an array (ndarray)
How to programatically generate sequences
How to restructure arrays
How to select sub-arrays
How to do linear algebra operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

You will be working with functions and methods. What is the difference between a function and a method?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can you create a one-dimensional array in NumPy?

A

Convert a list to an array using the array function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you create a 2-dimensional array?

A

Convert a list of lists using the array function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to programatically generate an array with a range of integers from 0 to N-1?

A

np.arange(0,11)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to programatically generate an array of even numbers from 0 to N-1?

A

np.arange(0,11,2)
=np.arange(start, stop, increment)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly