Assessment: Analyzing Patient Data

Oct 1, 2014 • Jon Guyer

Q1: Given the NumPy array

>>> print data
[[ 0  2  4  6  8 10 12 14 16 18]
 [ 1  3  5  7  9 11 13 15 17 19]
 [ 2  4  6  8 10 12 14 16 18 20]
 [ 3  5  7  9 11 13 15 17 19 21]
 [ 4  6  8 10 12 14 16 18 20 22]
 [ 5  7  9 11 13 15 17 19 21 23]
 [ 6  8 10 12 14 16 18 20 22 24]
 [ 7  9 11 13 15 17 19 21 23 25]
 [ 8 10 12 14 16 18 20 22 24 26]
 [ 9 11 13 15 17 19 21 23 25 27]]

Choose the result of

print data[2:4, 3:5]
  1. [[ 8 10 12]
     [ 9 11 13]
     [10 12 14]]
  2. [[ 5  7]
     [ 6  8]]
  3. [[ 7  9]
     [ 8 10]]
  4. [[ 8 10]
     [ 9 11]]
  5. [[10 12]
     [11 13]]

 

Q2: Given the NumPy array

>>> print data
[ 0  1  2  3  4  5  6]

explain the difference between

>>> data[:] = 3

and

>>> data = 3