Table of Contents
ToggleIn data science and ML, **visualizing your data** is often the most important step. In this lesson, you’ll use Python’s most popular plotting libraries: Matplotlib and Seaborn to create clean and insightful charts.
Matplotlib is the foundation of all charting in Python. It’s flexible and powerful for basic plotting.
import matplotlib.pyplot as plt
x = [1, 2, 3]
y = [4, 1, 8]
plt.plot(x, y)
plt.show()
Output: Line chart connecting the points (1,4), (2,1), (3,8)
Seaborn is built on Matplotlib but designed for **statistical graphics**. It’s great for visualizing Pandas DataFrames.
import seaborn as sns
import pandas as pd
df = pd.read_csv("tips.csv")
sns.barplot(x="day", y="total_bill", data=df)
Output: Bar plot of average bills per day.
plt.show() do?🎉 Congrats! You’ve completed Module 2. Up next: **Data Preprocessing – Cleaning and preparing real datasets for ML.**
