Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Associate Data Practitioner practice bank has 1,156 more like it. Try 10 free: instant score, no account.
A data analyst has loaded transaction records from BigQuery into a pandas DataFrame within a Colab Enterprise notebook. The dataset includes continuous numerical transaction amounts across several store departments. The analyst needs to visualize the statistical distribution of transaction amounts for each department to easily compare the median, interquartile ranges, and identify potential outliers.
Which Python visualization approach should the analyst use to meet these requirements?
lineplot() function (sns.lineplot(data=df, x='department', y='amount')) to plot trend lines across departments.lineplot() DoesSeaborn's sns.lineplot() function draws a line plot that connects data points sequentially across an ordered x-axis. By default, it aggregates numerical values sharing the same x-coordinate and plots the mean value accompanied by a shaded 95% confidence interval band.
lineplot shows the mean and confidence intervals, it hides the median, interquartile range (IQR), and min/max boundaries.The scenario stated: "Track daily total transaction trends over a 12-month period to observe seasonal changes and calculate confidence intervals over time."
mark_bar() to create a stacked bar chart displaying the cumulative sum of transaction amounts per department.mark_bar() DoesAltair is a declarative statistical visualization library for Python based on Vega and Vega-Lite. Its mark_bar() method renders bar charts and stacked bar charts by mapping categorical dimensions to visual bars and aggregated numerical values (such as sum(amount) or count()) to bar lengths.
The requirement asked to: "Compare the total cumulative sales revenue generated by each department to evaluate overall department contribution to the company's gross income."
pie() function (plt.pie(df['amount'])) to show the proportion of every individual transaction value.pie() DoesMatplotlib is a foundational 2D plotting library in Python, and its plt.pie() function creates a pie chart. A pie chart displays data as proportional slices of a circular graphic, where each slice represents a part-to-whole relationship.
The goal was to display the overall percentage share of total company sales contributed by a small handful of top-level categories (e.g., "Display the market share breakdown among 4 main product lines as percentage slices of a total").
boxplot() function (sns.boxplot(data=df, x='department', y='amount')) to generate side-by-side box plots for each department.boxplot() IsSeaborn is a popular Python data visualization library built on top of Matplotlib that closely integrates with pandas DataFrames. The sns.boxplot() function renders a box-and-whisker plot, which visually summarizes the distribution of a continuous numerical variable across different categorical levels using standard statistical metrics.
x='department' and y='amount', Seaborn places box plots side by side for each department on the categorical axis, enabling immediate visual comparison.data=df argument allows seamless column referencing directly from the underlying pandas DataFrame in a notebook environment.
Compared to bar charts, line plots, or pie charts, a box plot is the standard statistical chart designed specifically to reveal medians, spread, skewness, and outliers across categories in a single view.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated