Palmer Penguins#

Body measurements of 344 penguins of three species, observed on three islands of the Palmer Archipelago in Antarctica between 2007 and 2009. It is a friendly alternative to Iris, and the first dataset here with missing values and categorical features, which makes it a good place to practise imputation and encoding.

Overview#

Loader

load_penguins()

Task

Classification

Samples

344

Features

7

Targets

3 classes: Adelie (0), Chinstrap (1), Gentoo (2)

Missing values

19 values in 5 columns, stored as NaN

License

CC0 1.0

Features#

island and sex are categorical and stored as integer codes, the names of the categories are in data.info.categorical. bill_length_mm, bill_depth_mm, flipper_length_mm, body_mass_g and year are numbers. Missing values are NaN. Use data.categorical_features to find the categorical columns.

Target#

y is the species: 0 for Adelie (152 penguins), 1 for Chinstrap (68) and 2 for Gentoo (124). The target has no missing values.

Source and citation#

Please cite the dataset as:

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

See also:

License#

CC0 1.0, as stated by the source. The license was checked at the source on 2026-10-17. See License and citation.

Changes made#

  • Converted to the NumPy NPZ format. Measurements are stored as float64 and the species as int64 labels (0 = Adelie, 1 = Chinstrap, 2 = Gentoo).

  • The columns island and sex are stored as integer codes, see the categorical features. The missing values (NA in the CSV file) are stored as NaN.

  • All columns except the species are features. No row and no column was removed.

Note

The data are released under CC0. The package page also asks anyone who wants to publish with the data to contact its creator about the analysis and final products, and expects users to follow the US LTER Network Data Access Policy.

Example#

>>> import numpy as np
>>> from pyml_datasets import load_penguins
>>> data = load_penguins()
>>> data.X.shape
(344, 7)
>>> data.has_missing, int(np.isnan(data.X).sum())
(True, 19)
>>> data.categorical_features
(0, 5)
>>> data.info.categorical["sex"]
('female', 'male')