0% found this document useful (0 votes)
14 views1 page

Quiz 1 ISE 291

Uploaded by

jt89xgmzxd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

Quiz 1 ISE 291

Uploaded by

jt89xgmzxd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

List Comprehensions np.

linspace(0,1,11) * to create line array


distributed equally
PV = ['+' if x % 2 == 0 else '-' for x in
numbers if x.isdigit()]
shape, size and dimensions
Enumerate x1.ndim
x1.shape
listFruits = [str(i+1)+'.'+v for i,v in x1.size
enumerate(fruits)] x1.tolist() #.tolist() converts numpy array
into python's list. NOT PERMENANT
printed statement
->['1.Apple', '2.Banana', '3.Grapes', stacking/spliting
'4.Kiwi', '5.Orange', '6.Pear', '7.Plum', np.concatenate((x,y,z))
'8.Strawberry', '9.Watermelon'] np.vstack((x,y,z))
np.hstack([z,y])
Zip x1, x2, x3 = np.split(x, [3,5])
zipZap = list(zip(allFruits,lenFruits))
Topic 3
printed statement
import matplotlib.pyplot as plt
->[('Apple', 5), ('Banana', 6), ('Orange', 6),
plt.figure(figsize=(5,5))
('Watermelon', 10), ('Plum', 4), ('Grapes',
plt.hist(Score,bins=[71,81,91,100]) #
6), ('Kiwi', 4), ('Strawberry', 10), ('Pear', 4),
Creates three bins as: 71-80, 81-90, 91-
('Mango', 5)]
100
Also works with dict.
plt.show()
book2 =
dict(zip(list(range(len(fruits))),fruits))
subj_labels, subj_counts =
np.unique(Subj,return_counts=True) #to
Lambda & Map
get the count and name of array
plt.pie(subj_counts, labels =
print((lambda x, y, z : x + y * z)(5, 6, 2))
subj_labels,autopct='%.2f%%') #autopct to
print((lambda x : f"{x} is an even number."
format labels
if x%2==0 else f"{x} is an odd number.")
plt.show()
(7))
numbers = [1, 2, 3, 4, 5]
plt.boxplot(Score)
squares = list(map((lambda x:x**2),
plt.title('Box Plot')
numbers))

Numpy Library tests


from scipy.stats import Shapiro
import numpy as np from scipy.stats import ttest_ind
np.zeros(n, dtype="int") from scipy.stats import mannwhitneyu
np.ones((m,n), dtype="float")
np.full((m,n), any number)
np.random.seed(n)
np.random.random((m,n))
np.random.randint(lower,
upper(exclusive),(m,n))

You might also like