Exercise

Your First 2D NumPy Array

Before working on the actual MLB data, let's try to create a 2D numpy array from a small list of lists.

In this exercise, baseball is a list of lists. The main list contains 4 elements. Each of these elements is a list containing the height and the weight of 4 baseball players, in this order. baseball is already coded for you in the script.

Instructions

100 XP
  • Use np.array() to create a 2D numpy array from baseball. Name it np_baseball.
  • Print out the type of np_baseball.
  • Print out the shape attribute of np_baseball. Use np_baseball.shape.