Skip to content

Commit

Permalink
Add palmerpenguins dataset
Browse files Browse the repository at this point in the history
closes #771
  • Loading branch information
has2k1 committed Apr 22, 2024
1 parent 2cfe165 commit e8234bd
Show file tree
Hide file tree
Showing 3 changed files with 396 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ title: Changelog
- Fix bug in [](:class:`~plotnine.position_dodge2`) the widths of the dodged
objects were mixed up. ({{< issue 772 >}})

### Enhancements

- Added _palmerpenguins_ dataset.

## v0.13.4
(2024-04-03)

Expand Down
47 changes: 47 additions & 0 deletions plotnine/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"msleep",
"mtcars",
"pageviews",
"penguins",
"presidential",
"seals",
"txhousing",
Expand All @@ -37,6 +38,7 @@
economics_long = pd.read_csv(DATA_DIR / "economics_long.csv", parse_dates=[0])
presidential = pd.read_csv(DATA_DIR / "presidential.csv", parse_dates=[1, 2])
txhousing = pd.read_csv(DATA_DIR / "txhousing.csv")
penguins = pd.read_csv(DATA_DIR / "penguins.csv")
luv_colours = pd.read_csv(DATA_DIR / "luv_colours.csv")
faithfuld = pd.read_csv(DATA_DIR / "faithfuld.csv")
faithful = pd.read_csv(DATA_DIR / "faithful.csv")
Expand Down Expand Up @@ -93,6 +95,7 @@ def _process_categories():
)
midwest = _unordered_categories(midwest, ["category"])
msleep = _unordered_categories(msleep, ["vore", "conservation"])
peguins = _unordered_categories(penguins, ["species", "island", "sex"])


_process_categories()
Expand Down Expand Up @@ -246,6 +249,50 @@ def _process_categories():

economics_long.__doc__ = economics.__doc__

penguins.__doc__ = """
Palmer Penguins
## Description
Data about 3 different species of penguins collected from 3 islands
in the Palmer Archipelago, Antarctica.
## Format
A dataframe with 344 rows and 8 variables
+--------------------+------------------------------------------------+
| Column | Description |
+====================+================================================+
| species | Penguin species (Adélie, Chinstrap and Gentoo) |
+--------------------+------------------------------------------------+
| island | Island in Palmer Archipelago, Antarctica |
| | (Biscoe, Dream or Torgersen) |
+--------------------+------------------------------------------------+
| bill_length_mm | Bill length (millimeters) |
+--------------------+------------------------------------------------+
| bill_depth_mm | Bill depth (millimeters) |
+--------------------+------------------------------------------------+
| flipper_length_mm | Flipper length (millimeters) |
+--------------------+------------------------------------------------+
| body_mass_g | Body mass (grams) |
+--------------------+------------------------------------------------+
| sex | Penguin sex (female, male) |
+--------------------+------------------------------------------------+
| year | The study year (2007, 2008, or 2009) |
+--------------------+------------------------------------------------+
## Source
Collected by [Dr. Kristen Gorman]\
(https://www.uaf.edu/cfos/people/faculty/detail/kristen-gorman.php)
and the [Palmer Station, Antarctica LTER](https://pallter.marine.rutgers.edu/).
Made conveniently availabe by
[Alison Horst](https://github.com/allisonhorst/palmerpenguins/) to serve as
a dataset exploration and visualisation.
"""

presidential.__doc__ = """
Terms of 11 presidents from Eisenhower to Obama.
Expand Down
Loading

0 comments on commit e8234bd

Please sign in to comment.