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
From the course: Data Analysis with Python and Pandas
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
pandas and NumPy intro2m 53s
-
(Locked)
NumPy arrays and array properties7m 41s
-
(Locked)
Challenge: Array basics1m 47s
-
(Locked)
Solution: Array basics2m 2s
-
(Locked)
Array creation8m 13s
-
(Locked)
Random number generation5m 58s
-
(Locked)
Challenge: Array creation1m 30s
-
(Locked)
Solution: Array creation4m 22s
-
(Locked)
Indexing and slicing arrays9m 9s
-
(Locked)
Challenge: Indexing and slicing arrays1m 6s
-
(Locked)
Solution: Indexing and slicing arrays2m 23s
-
(Locked)
Array operations7m 45s
-
(Locked)
Challenge: Array operations2m 6s
-
(Locked)
Solution: Array operations4m 16s
-
(Locked)
Filtering arrays and modifying array values10m 56s
-
(Locked)
The where() function4m
-
(Locked)
Challenge: Filtering and modifying arrays1m 57s
-
(Locked)
Solution: Filtering and modifying arrays3m 11s
-
(Locked)
Array aggregation6m 51s
-
(Locked)
Array functions7m 41s
-
(Locked)
Sorting arrays3m 51s
-
(Locked)
Challenge: Aggregation and sorting1m 11s
-
(Locked)
Solution: Aggregation and sorting1m 35s
-
(Locked)
Vectorization4m 19s
-
(Locked)
Broadcasting7m 8s
-
(Locked)
Challenge: Bringing it all together2m 45s
-
(Locked)
Solution: Bringing it all together6m 18s
-
(Locked)
Key takeaways1m 56s
-
(Locked)
-
-
-
-
-
-
-
-
-