plot where there are missing data in matplotlib in python

To visualize missing data in a dataset, we can use the missingno library.

To install the missingno library, run the following command on your terminal or command prompt.

main.py
pip install missingno
22 chars
2 lines

After installation, you can use it as follows:

main.py
import missingno as msno
import pandas as pd
import matplotlib.pyplot as plt

# Load dataset
df = pd.read_csv('my_dataset.csv')

# Create graph
msno.matrix(df)
plt.show()
171 chars
11 lines

This will create a matrix plot where the presence and absence of data in each column is plotted as a black and white bar. The white part of the graph indicates missing values.

related categories

gistlibby LogSnag