1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to NumPy

Connected

Exercise

Stepping into 2D

Now assume that your research requires you to take an admittedly unrepresentative sample of trunk diameters, which are located in the third column of tree_census. Getting just a selection of trunk diameters can be done with NumPy's slicing and stepping functionality.

numpy is loaded as np, and the tree_census 2D array is available.

Instructions 1/2

undefined XP
  • 1
    • Create an array called hundred_diameters which contains the first 100 trunk diameters in tree_census.
  • 2
    • Create an array,every_other_diameter, which contains only trunk diameters for trees with even row indices from 50 to 100, inclusive.