nerdexam
Amazon

MLS-C01 · Question #333

A data scientist is building a forecasting model for a retail company by using the most recent 5 years of sales records that are stored in a data warehouse. The dataset contains sales records for…

The correct answer is D. Create an aggregated dataset by using the Pandas GroupBy function to get average sales for. To analyze yearly average sales for each region and compare them to overall averages, the data scientist should aggregate the dataset by both region and year to derive the necessary insights.

Exploratory Data Analysis

Question

A data scientist is building a forecasting model for a retail company by using the most recent 5 years of sales records that are stored in a data warehouse. The dataset contains sales records for each of the company's stores across five commercial regions. The data scientist creates a working dataset with StoreID. Region. Date, and Sales Amount as columns. The data scientist wants to analyze yearly average sales for each region. The scientist also wants to compare how each region performed compared to average sales across all commercial regions. Which visualization will help the data scientist better understand the data trend?

Options

  • ACreate an aggregated dataset by using the Pandas GroupBy function to get average sales for
  • BCreate an aggregated dataset by using the Pandas GroupBy function to get average sales for
  • CCreate an aggregated dataset by using the Pandas GroupBy function to get average sales for
  • DCreate an aggregated dataset by using the Pandas GroupBy function to get average sales for

How the community answered

(26 responses)
  • A
    12% (3)
  • B
    4% (1)
  • C
    4% (1)
  • D
    81% (21)

Why each option

To analyze yearly average sales for each region and compare them to overall averages, the data scientist should aggregate the dataset by both region and year to derive the necessary insights.

ACreate an aggregated dataset by using the Pandas GroupBy function to get average sales for

Aggregating only by `Date` would not provide a breakdown by region, failing to meet the requirement of yearly average sales for *each region*.

BCreate an aggregated dataset by using the Pandas GroupBy function to get average sales for

Aggregating by `StoreID` is too granular for analyzing trends at the 'region' level as required by the question.

CCreate an aggregated dataset by using the Pandas GroupBy function to get average sales for

Aggregating only by `Region` would provide an overall average per region but not the 'yearly average sales for each region', which is a specific requirement.

DCreate an aggregated dataset by using the Pandas GroupBy function to get average sales forCorrect

To analyze 'yearly average sales for each region' and compare 'each region performed compared to average sales across all commercial regions', the most appropriate initial aggregation is to group the data by 'Region' and then by 'Year' (derived from the Date column) to calculate average sales.

Concept tested: Pandas GroupBy for time-series aggregation

Source: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.groupby.html

Topics

#Data Visualization#Data Aggregation#Trend Analysis#Comparative Analysis

Community Discussion

No community discussion yet for this question.

Full MLS-C01 Practice