A retail company has daily sales data stored in a NumPy array. Explain how you would use NumPy to calculate the average daily sales, find the day with maximum sales, and identify how many days had sales above a certain threshold. Why would NumPy be faster than using Python loops for these calculations?
Author: Anonymous
Given a 2D array, what does axis=1 refer to when using aggre…
Given a 2D array, what does axis=1 refer to when using aggregation functions?
A company tracks website performance with a (30, 24) array r…
A company tracks website performance with a (30, 24) array representing 30 days of hourly page views. Explain how you would use NumPy to: (1) find the day with the highest total traffic, (2) calculate the average traffic for each hour of the day, and (3) identify all hours that exceeded 1000 views.
To get the minimum value along each column of a 2D array, yo…
To get the minimum value along each column of a 2D array, you use np.min(arr, axis=__).
What is the result of np.any(arr > 10) for arr = np.array([5…
What is the result of np.any(arr > 10) for arr = np.array([5, 8, 12, 3])?
What does boolean indexing allow you to do?
What does boolean indexing allow you to do?
To stack two 1D arrays vertically into a 2D array, you use _…
To stack two 1D arrays vertically into a 2D array, you use __.
A quality control analyst has measurements from 100 products…
A quality control analyst has measurements from 100 products across 5 different sensors (a 100×5 array). Explain how you would use NumPy to find: (1) the average reading for each sensor, (2) products where any sensor reading exceeds a threshold, and (3) the sensor with the highest variability. Which axis parameter would you use for each calculation and why?
Which method creates a new column in a DataFrame?
Which method creates a new column in a DataFrame?
You have sales data with columns: date, store_id, product, q…
You have sales data with columns: date, store_id, product, quantity, revenue. Explain how you would use Pandas to: (1) calculate total revenue per store, (2) find the top 5 best-selling products by quantity, and (3) create a new column showing revenue per unit.