Back to marketplace

Intro To NumPy Arrays

No description yet. This curated deck is ready for daily study.

Total cards: 9•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (9)

#1
Front (Question)

How to import NumPy

Back (Answer)

Import numpy as np

#2
Front (Question)

Converting a list to a numpy array

Back (Answer)

price_array = np.array(price) quantity_sold_array = np.array(quantity_sold) type(price_array Output - numpy.ndarray

#3
Front (Question)

Adding to array

Back (Answer)

Price_array = price_array + [7] print(price_array) Output- [9 8 17]

#4
Front (Question)

To get original value back, we subtract 6, then use np.append() function to include the value 7 as desired

Back (Answer)

Price_array = price_array -[7] Price_array = np.append(price_array, 7) Print(price_array) Output- [2 1 10 7]

#5
Front (Question)

To append multiple values to the array in one command

Back (Answer)

Price_array = np.append(price_array, [4.50, 3, 4, 9]) print(price_array) Output- [2. 1. 10. 7. 4.5 3. 4. 9.]

#6
Front (Question)

To accommodate a value with decimal point and To check the data type of elements within the array

Back (Answer)

print(price.array.dtype) Output- float64

#7
Front (Question)

To delete element in array

Back (Answer)

We use indexing, we can use negative price_array = np.delete(price_array, -1) Print(price_array) Output- [2. 1. 10. 7. 4.5 3. 4.]

#8
Front (Question)

To replace element in array

Back (Answer)

Identify the index and use this function price_array[2] = 12 print(price_array) Output- [ 2. 1. 12. 7. 4.5 3. 4. ]

#9
Front (Question)

How to use enumerate function to slice out dinner options with its integer index

Back (Answer)

For I, food in enumerate(options_array): print(f’ {i}: {food} ‘)