Data Analysis Fundamentals

Visualizing Analysis Results

In the Matplotlib series, charts were standalone exercises. Here, the data comes from real analysis. value_counts(), groupby(), and DataFrame columns feed directly into plots.


The Matplotlib series covered plotting as a standalone skill. Here, the data comes from real analysis. A value_counts() result feeds a bar chart, a groupby() mean becomes a comparison.

Every pandas Series already has an index (labels) and values (numbers). That is exactly what matplotlib needs:

Python
Output

That index and values pair plugs straight into plt.bar():

Python

Long category names overlap on the x-axis. Switching to plt.barh() for horizontal bars solves this instantly.

Same arguments as plt.bar(), just a horizontal layout:

Python

Large numbers like 3500000 display as 3.5e6 on axes, which is hard to read. Dividing by 1_000_000 before plotting and labeling the axis as "Million USD" fixes this.


What will be the output?

Python

Remember value_counts() from the earlier lesson? Its result is already a Series: categories as the index, counts as the values:

Python
Output

That value_counts() Series feeds directly into plt.bar(). No reshaping needed:

Python

The same pattern works for groupby() results. Aggregated data is already a plottable Series:

Python

What will be the output?

Python

To check whether two numeric columns are related, pass them to plt.scatter():

Python

Choosing the right chart: bar chart → compare categories, histogram → see how values are spread, scatter plot → spot relationships between two numbers.


What will be the output?

Python

What will be the output?

Python

What will be the output?

Python