From the course: Data Analysis with Python and Pandas

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Challenge: Bringing it all together

Challenge: Bringing it all together

- [Instructor] New email in from Ross Retail, subject line is Final NumPy challenge. He writes us, Alright, our new data scientist set up a little test case for us. She provided code to read in data from a CSV file and convert two columns to arrays. Filter the "sales_array" to include only sales that had the product family 'PRODUCE' in the 'family_array'. Then randomly sample half of the remaining sales and calculate the mean and median of those sales. Finally create a new array that contains 'above_both' if the sales are greater than the mean and median, 'above_median' if only above the median, and 'below_both' otherwise. Thanks! We're still working out of our NumPy assignments notebook. If we take a look at a results, we can see the mean was $2,268 and change and the median was $1,272. So our mean is greater than our median. So we need three categories for that final array. It's either going to be below both, in between the mean and median, which is going to be above median, or it's…

Contents