Palmer Penguins Analysis

python
visualization
analysis
An exploratory analysis of penguin species using Python, Pandas and Seaborn.
Author

E. Pitzer

Published

November 23, 2025

Introduction

This project explores the famous Palmer Penguins dataset. We will look at the relationship between flipper length and body mass across three different species: Adelie, Chinstrap, and Gentoo.

Setup

First, we import the necessary libraries and load the data directly from the source.

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# Load the dataset directly from GitHub URL
url = "https://raw.githubusercontent.com/allisonhorst/palmerpenguins/master/inst/extdata/penguins.csv"
penguins = pd.read_csv(url)

# Display the first 5 rows
penguins.head()
species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g sex year
0 Adelie Torgersen 39.1 18.7 181.0 3750.0 male 2007
1 Adelie Torgersen 39.5 17.4 186.0 3800.0 female 2007
2 Adelie Torgersen 40.3 18.0 195.0 3250.0 female 2007
3 Adelie Torgersen NaN NaN NaN NaN NaN 2007
4 Adelie Torgersen 36.7 19.3 193.0 3450.0 female 2007

Visualization: Flipper Length vs. Body Mass

We want to see if larger flippers correlate with higher body mass.

# Set a nice theme
sns.set_theme(style="whitegrid")

# Create the plot
plt.figure(figsize=(10, 6))
plot = sns.scatterplot(
    data=penguins,
    x="flipper_length_mm",
    y="body_mass_g",
    hue="species",
    palette="viridis",
    alpha=0.7
)

plt.title("Penguin Size Characteristics")
plt.xlabel("Flipper Length (mm)")
plt.ylabel("Body Mass (g)")

# Save the thumbnail for the gallery
plt.savefig("penguin_plot.png")

# Show the plot
plt.show()
Figure 1: Scatter plot of Flipper Length vs Body Mass
NoteData Citation

Data Source: Horst AM, Hill AP, Gorman KB (2020). palmerpenguins: Palmer Archipelago (Antarctica) penguin data. R package version 0.1.0. https://allisonhorst.github.io/palmerpenguins/

Original Research: Gorman KB, Williams TD, Fraser WR (2014) Ecological Sexual Dimorphism and Environmental Variability within a Community of Antarctic Penguins (Genus Pygoscelis). PLoS ONE 9(3): e90081. doi:10.1371/journal.pone.0090081