-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathyour-first-numpy-array.py
More file actions
26 lines (21 loc) · 912 Bytes
/
your-first-numpy-array.py
File metadata and controls
26 lines (21 loc) · 912 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
'''
Your First NumPy Array
100xp
In this chapter, we're going to dive into the world of baseball. Along the way, you'll get
comfortable with the basics of numpy, a powerful package to do data science.
A list baseball has already been defined in the Python script, representing the height of
some baseball players in centimeters. Can you add some code here and there to create a numpy
array from it?
Instructions
-Import the numpy package as np, so that you can refer to numpy with np.
-Use np.array() to create a numpy array from baseball. Name this array np_baseball.
-Print out the type of np_baseball to check that you got it right.
'''
# Create list baseball
baseball = [180, 215, 210, 210, 188, 176, 209, 200]
# Import the numpy package as np
import numpy as np
# Create a numpy array from baseball: np_baseball
np_baseball = np.array(baseball)
# Print out type of np_baseball
print(type(np_baseball))