My first real blog
Loading the palmerpenguins dataset with pandas and plotting penguin counts per species with matplotlib.
· 1 min read
The palmerpenguins dataset is always useful.
from palmerpenguins import load_penguinsimport pandas as pdimport numpy as np
penguins_df = load_penguins()penguins_cleaned_df = penguins_df.dropna()
species_counts = penguins_cleaned_df['species'].value_counts()Showing Matplotlib charts
We can display matplotlib charts directly:
import matplotlib.pyplot as plt
plot = plt.figure()plot.set_figwidth(6)plot.set_figheight(3)
plt.bar(species_counts.index, species_counts.values)
And save the figure for later:
plot.savefig("matplotlib_bar.png")