Plotting Missing Values in Pandas – Visualizing NaNs Effectively 2026
Visualizing missing values is one of the best ways to understand their pattern and impact. In 2026, combining Pandas with Seaborn and Matplotlib allows you to create clear, insightful visualizations that reveal where and how missing data occurs in your dataset.
TL;DR — Best Visualization Methods
sns.heatmap(df.isna())– Missing value heatmap (most popular)- Bar plot of missing percentages per column
- Row-wise missing value distribution
1. Missing Values Heatmap (Most Recommended)
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_csv("sales_data.csv", parse_dates=["order_date"])
plt.figure(figsize=(12, 8))
sns.heatmap(
df.isna(),
cbar=False,
cmap="viridis",
yticklabels=False
)
plt.title("Missing Values Heatmap (White = Missing)")
plt.xlabel("Columns")
plt.ylabel("Rows")
plt.show()
2. Bar Plot – Missing Values Percentage per Column
missing_pct = df.isna().mean() * 100
plt.figure(figsize=(12, 6))
missing_pct.sort_values(ascending=False).plot(
kind="bar",
color="tomato",
edgecolor="black"
)
plt.title("Percentage of Missing Values by Column")
plt.ylabel("Missing Percentage (%)")
plt.xlabel("Column Name")
plt.xticks(rotation=45, ha="right")
plt.tight_layout()
plt.show()
3. Distribution of Missing Values per Row
row_missing = df.isna().sum(axis=1)
plt.figure(figsize=(10, 6))
row_missing.value_counts().sort_index().plot(
kind="bar",
color="steelblue"
)
plt.title("Number of Missing Values per Row")
plt.xlabel("Number of Missing Values in a Row")
plt.ylabel("Count of Rows")
plt.show()
4. Best Practices for Visualizing Missing Values in 2026
- Use a **heatmap** (`sns.heatmap(df.isna())`) as your primary visualization — it shows the pattern clearly
- Create a bar plot of missing percentages sorted from highest to lowest
- Visualize the distribution of missing values per row to spot problematic records
- Use a consistent color scheme (e.g., dark colors for present, bright for missing)
- Always include a clear title and proper labels
Conclusion
Visualizing missing values is much more insightful than just counting them. In 2026, the combination of a missing value heatmap, percentage bar plot, and row-wise distribution gives you a complete understanding of missing data patterns in your dataset. These visualizations should be one of the first steps in your exploratory data analysis (EDA) process.
Next steps:
- Create a missing values heatmap and a percentage bar plot for one of your current datasets to understand the missing data pattern