Sorting Along Axes with NumPy
📖 Scenario: Imagine you work in a small bakery. You have a list of daily sales for different types of bread over a week. You want to organize this data to see which days had the lowest to highest sales for each bread type and also which bread types sold the least to most on each day.
🎯 Goal: You will create a 2D NumPy array representing sales data, then sort the sales along rows and columns to better understand sales patterns.
📋 What You'll Learn
Create a 2D NumPy array called
sales with exact valuesCreate a variable called
axis_row set to 1Create a variable called
axis_col set to 0Sort the
sales array along rows using axis_rowSort the
sales array along columns using axis_colPrint both sorted arrays exactly as specified
💡 Why This Matters
🌍 Real World
Sorting sales data helps businesses quickly identify trends, like which products sell best on certain days or which days have the highest sales.
💼 Career
Data scientists and analysts often sort data along different axes to prepare it for reports, visualizations, or further analysis.
Progress0 / 4 steps