-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_demo_3.py
More file actions
27 lines (21 loc) · 836 Bytes
/
Python_demo_3.py
File metadata and controls
27 lines (21 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# np_baseball is available
# Import numpy
import numpy as np
np_baseball = np.array([[74., 180., 22.99],
[74., 215., 34.69],
[72., 210., 30.78],
[75., 205., 25.19],
[75., 190., 31.01],
[73., 195., 27.92]])
# Print mean height (first column)
avg = np.mean(np_baseball[:, 0])
print("Average: " + str(avg))
# Print median height. Replace 'None'
med = np.median(np_baseball[:, 0])
print("Median: " + str(med))
# Print out the standard deviation on height. Replace 'None'
stddev = np.std(np_baseball[:, 0])
print("Standard Deviation: " + str(stddev))
# Print out correlation between first and second column. Replace 'None'
corr = np.corrcoef(np_baseball[:, 0], np_baseball[:, 1])
print("Correlation: " + str(corr))