Methods of Healthcare Leaders | Test Questions and
Answers | Grade A | 100% Correct (Verified Answers) -
WGU
Import NumPy –AN SWERimport numpy as np
How to replace stuff -ANSWER.replace()
Page | 1
Can chain with .replace().replace()
How to make pandas index -ANSWERchicago_crime.index =
chicago_crime['CASE#']
Specify a data column to use as the index -
ANSWERindex_col='institution_name'
Use columns -ANSWERusecols=[0, 1, 2]
How to print out multiple stuff on one line -ANSWERUse commas to
separate the printed statements
print("Some string", a_variable)
How to print multiple stuff and then print out space beneath the
printed statement -ANSWERUse '\n'
print("One Dimensional Array", x1, '\n')
, D514 / D 514 Final Exam (Latest Update ) Analytical
Methods of Healthcare Leaders | Test Questions and
Answers | Grade A | 100% Correct (Verified Answers) -
WGU
How to separate stuff from a printed statement into different
paragraphs -ANSWERUse sep='\n'
Page | 2
print("One Dimensional Array", x1, sep='\n')
Two dimensional array -ANSWERmy_array= np.array([[3,4,5,6],[4,5,6,-
9]])
How to return the number of dimensions an array has -
ANSWERx1.ndim
Return the number of elements a in each dimension of an array -
ANSWERx1.shape
Return the total number of elements across all dimensions of an array -
ANSWERx1.size
How to tell the data types of elements in an array -
ANSWERfloat_array.dtype
Return every third element of an array -ANSWERmy_array[::3]
, D514 / D 514 Final Exam (Latest Update ) Analytical
Methods of Healthcare Leaders | Test Questions and
Answers | Grade A | 100% Correct (Verified Answers) -
WGU
Return every other element, starting with the first element -
ANSWERmy_array[1::2]
Page | 3
How to reverse an array -ANSWERnumeric_array[::-1]
How to add value to dictionary -ANSWERNo brackets on other side
university_info['country'] = 'United States'
university_info
Function rule -ANSWERAlways return, don't print
How to sort with numpy -ANSWERnp.sort()
For multidimensional arrays, specify axis
np.sort(my_array, axis=0)
0 sorts columns, and 1 sorts rows