Skip to main content

lazy-rdatasets

Convenience interface of Rdatasets for lazy data scientists.

Key features

  • Search and filter datasets by text, data types, no. samples, and no. features/parameters
  • Randomly select a dataset
  • Easily do basic visualizations without writing many lines

Install

Use pip:

pip install lazy-rdatasets

Usage

List all available datasets

from lazyrdatasets import LazyRdatasets

rd = LazyRdatasets()
rd
   Package  Item           Title                              Rows  Cols  ...
0  AER      Affairs        Fair's Extramarital Affairs Data    601     9  ...
1  AER      ArgentinaCPI   Consumer Price Index in Argentina    80     2  ...
2  AER      BankWages      Bank Wages                          474     4  ...
3  AER      BenderlyZwick  Benderly and Zwick Data: Infla...    31     5  ...
4  AER      BondYield      Bond Yield Data                      60     2  ...
...

Finding datasets

1. Exact match on the package and item names

This is almost the same as statsmodels.datasets.get_rdatasets.

from lazyrdatasets import LazyRdatasets

rd = LazyRdatasets.find(package="palmerpenguins", item="penguins", exact=True)

2. Search a string in the title of datasets

Find datasets that have "penguin" in their title:

from lazyrdatasets import LazyRdatasets

rd = LazyRdatasets.find(title="penguin")

3. Filtering datasets that contains particular types of variables

Find datasets that have categorical variables:

from lazyrdatasets import LazyRdatasets

rd = LazyRdatasets.find(categorical=True)

Find datasets that have only one numeric variables with more than 99 samples:

from lazyrdatasets import LazyRdatasets

rd = LazyRdatasets.find(numeric=True, nmin=100, pmax=1)

Getting a single dataset from Rdatasets

Below, rd is the output of the following code block:

from lazyrdatasets import LazyRdatasets

rd = LazyRdatasets.find(title="penguin")

1. Show the list of datasets that matched the conditions

rd  # On jupyter, this will show the same result as below.
rd.catalog  # Show the repr of DataFrame
      Package          Item                     Title   ...
567   bayesrules       penguins_bayes           Penguins Data
1694  heplots          peng                     Size measurements ...
2116  modeldata        penguins                 Palmer Station penguin data
2559  palmerpenguins   penguins                 Size measurements for  ...
2560  palmerpenguins   penguins_raw (penguins)  Penguin size, clutch, ...

2. Pick the first dataset in the list

rd.first
#️⃣ Index  : 567
📦 Package: bayesrules
📄 Item   : penguins_bayes
📚 Title  : Penguins Data
📐 Shape  : (344, 10)
  ⚖️ Binary   : 2
  🔤 Character: 0
  🧮 Factor   : 4
  🔘 Logical  : 0
  🔢 Numeric  : 5
🔗 CSV: https://vincentarelbundock.github.io/Rdatasets/csv/bayesrules/penguins_bayes.csv
🔗 Doc: https://vincentarelbundock.github.io/Rdatasets/doc/bayesrules/penguins_bayes.html

3. Acceess by Index and position in the catalog

rd[2559]  # Get the Dataset with its index 2559 (pandas.DataFrame.loc), or ...
rd.at(3)  # Get the Dataset at position 3 in the catalog (pandas.DataFrame.iloc)
#️⃣ Index  : 2559
📦 Package: palmerpenguins
📄 Item   : penguins
📚 Title  : Size measurements for adult foraging penguins near Palmer Station, Antarctica
📐 Shape  : (344, 9)
  ⚖️ Binary   : 1
  🔤 Character: 0
  🧮 Factor   : 3
  🔘 Logical  : 0
  🔢 Numeric  : 5
🔗 CSV: https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv
🔗 Doc: https://vincentarelbundock.github.io/Rdatasets/doc/palmerpenguins/penguins.html

Getting the dataframe

ds = rd[2559]
ds.data  # -> pandas.DataFrame
   rownames species     island  bill_length_mm  bill_depth_mm ...
0         1  Adelie  Torgersen            39.1           18.7
1         2  Adelie  Torgersen            39.5           17.4
2         3  Adelie  Torgersen            40.3           18.0
3         4  Adelie  Torgersen             NaN            NaN
4         5  Adelie  Torgersen            36.7           19.3
...

Quicklook

Selected dataset can be easily quicklooked by

ds.quicklook()
Missing Values Categorical Variables Numeric Variables(p≧1) Numerical Variables (p≧3)
fig_missing fig_categorical fig_numeric fig_pca
Heatmap Bar plots Scatter matrix (p≧2) / histogram (p=1) PCA projection (p≧3)

This is of course not the best visualization, but might be helpful to get an overview of the dataset.

Metadata

Release files for lazyrdatasets 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lazyrdatasets 0.2.0
File Size Uploaded Provenance Actions
lazyrdatasets-0.2.0.tar.gz 9.3 kB Without provenance Details for lazyrdatasets-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lazyrdatasets 0.2.0
File Interpreter ABI Platform Actions
lazyrdatasets-0.2.0-py3-none-any.whl Python 3 none any Details for lazyrdatasets-0.2.0-py3-none-any.whl

Total release size: 17.5 kB

Release files / lazyrdatasets-0.2.0.tar.gz

Download URL lazyrdatasets-0.2.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c8057e2f2ee0a563e64387d63f57110f7321862ffbcc241063feb279dcac0276
BLAKE2b-256 checksum
How to use checksums
1edc1cd46dff11aa8d29d9607859c630af1106f4c7a47b018bbdaf67baff5e91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / lazyrdatasets-0.2.0-py3-none-any.whl

Download URL lazyrdatasets-0.2.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e144b8270e19e13da4affe46f49ba1f5949d6f6e51205e402a735c8c424856c
BLAKE2b-256 checksum
How to use checksums
70a5be46e9a7123a3a8c2289b6024ac7322a79e4f54802858edc136b71333a56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for lazyrdatasets 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page