Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Mean and Median with NumPy

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Mean and Median with NumPy. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

How do you calculate the mean and median using NumPy?

Asked in the 1st Round Technical Interview stage.

Implement calculate_statistics(values). The function receives a non-empty list of numbers and returns a dictionary with floating-point keys mean and median. Use NumPy for both calculations.

Constraints

  • 1 <= len(values) <= 100000
  • Values are finite integers or floating-point numbers
  • The input list is non-empty

Function Signature

def calculate_statistics(values):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output