Question: python debug and complete the code to find median from some sample: sorted_sample = np.sort(sample) N = sample.size if N%2 > 0: sample_median = sorted_sample[int(N/2)]
python debug and complete the code to find median from some sample:
sorted_sample = np.sort(sample) N = sample.size if N%2 > 0: sample_median = sorted_sample[int(N/2)] else: sample_median = 0.5*(sorted_sample[int(N/2)] + sorted_sample[int(N/2) + 1])
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
