BANA 6620 - Midterm Cards 42-61

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 8:10 PM on 9/13/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

20 Terms

1
New cards

Main purpose of NumPy?

Efficient storage and computation with arrays/matrices

2
New cards

NumPy array vs. Python list?

NumPy array → regular structure/ same data type

Python list → can contain different data types

3
New cards

.shape vs .size vs .ndim?

shape → dimensions

size → total elements

nidim → number of dimensions

4
New cards

A NumPy array has 3 rows and 4 columns.


What are:

shape, size, nidm?

shape = (3, 4)

size= 12

nidim= 2


ROWS FIRST

5
New cards

what does:

[::-1]

do?

Reverses the array

6
New cards

What does:

[::2]

do?

Selects every second element, beginning at index 0

7
New cards

What does np.ones((2,3)) create?

A 2-row x 3-column array filled with 1.0

8
New cards

What does np.zeros((4,2)) create?

A 4-row x 2-column array filled with 0.0

9
New cards

What does:

np.linspace (start, stop, num)

do?

Creates num evenly spaced values from start through stop

Stop is included by default.

10
New cards

np.random.rand(5)

5 random floats in:

[0,1)

11
New cards

Argument order:

np.random.normal(…)

normal(mean, std, size)

12
New cards

Argument order:

np.random.randint(…)

randint(low, high, size)

integers in:

[low, high)

13
New cards

How does NumPy arithmetic normally operate?

ELEMENT-WISE

arr*2

→ multiply every element by 2

14
New cards

Given:

arr = np.array([2,5,8])

What is:

arr*3

[6 15 24]

15
New cards

What does np.mean(arr) calculate?

Arithmetic average.

ADD divide HOW MANY

16
New cards

What does np.median(arr) calculate?

The middle value after ordering.

Even number of values → average the two middle values

17
New cards

axis=0 vs axis=1?

axis=0 → COLUMNS

axis=1 → ROWS

18
New cards

For a 3×4 array, how many answers does:

np.mean(arr, axis=0)

return?

One mean for each COLUMN

19
New cards

What does:

arr > 10

return?

A Boolean array:

True/Fales

20
New cards

What does:

arr[arr > 10 ]

return?

The actual VALUES greater than 10.

Comparison → mask

Boolean indexing → values