Data Analysis with Python: From Raw Data to Real-World Insights
BOOK 2 · APPLIED ANALYSIS · CHAPTER 12

Chapter 12 exercises: Diagnostic Visualization for Analysis

On this page

Attempt these tasks before opening the worked answers. Use the chapter experiment notebook, or import NumPy as np and Pandas as pd in your own notebook. Retain your first attempt and explain each correction.

B2-12-E01 · Specify a plotted observation

Select the scatterplot population and report both included and excluded counts.

df=pd.DataFrame({"mass":[3.,None,5.],"length":[1.,2.,3.]})
One hint after an attempt

Which fields must be observed for one point?

B2-12-E02 · Inspect histogram sensitivity

Compare counts with two and four equal-width bins. Do not infer a population mode solely from one bin choice.

x=np.array([1.,1.2,1.3,2.,2.1,4.])
One hint after an attempt

Check conservation of the observation count.

B2-12-E03 · Choose a diagnostic view

Order categories by count for a bar display and explain why a connected line would imply an unsupported ordering.

counts={"A":12,"B":7,"C":20}
One hint after an attempt

Identify the variable type before the chart.

Reflect and get feedback

Explain one result without looking at the code. Identify one boundary case that would change your method. An optional tutor prompt is: “Here is my attempt at B2-12-E03. Give one hint about the violated assumption; do not give the solution yet.” Then use the worked answers.

Teaching edition · verified experiments · PDF and EPUB editions not generated.