Python port of the R data package 'babynames'. This package provides US baby names data from the Social Security Administration (SSA). It contains all names used for at least 5 children of either sex in the United States. The package features the ability to switch between the data being imported as a Pandas DataFrame or a Polars DataFrame by setting an environment variable.
Project description
pybabynames
Python port of the R data package babynames. This package provides US baby names data from the Social Security Administration (SSA). It contains all names used for at least 5 children of either sex in the United States. The package features the ability to switch between the data being imported as a Polars DataFrame (default) or a Pandas DataFrame by setting an environment variable.
[!NOTE]
Please note that the
pybabynamespackage is a community-driven initiative and is not affiliated with Posit, Tidyverse, or the main babynames R package. Its evolution and maintenance stem solely from the collective efforts of community members.
Installation
Install this library using pip into an environment that already has either Pandas or Polars installed.
pip install pybabynames
Missing Pandas or Polars? You can install these packages using:
pip install polars
pip install pandas
Usage
import pybabynames as bn
# Retrieve DataFrame of baby names
babynames = bn.babynames
# Retrieve DataFrame of applicant data for SSN
applicants = bn.applicants
# Retrieve DataFrame of Birth Data
births = bn.births
# Retrieve DataFrame of life expectancy
lifetables = bn.lifetables
[!IMPORTANT]
By default, we'll attempt to use the
polarsmodule. You can switch back to usingpandasby specifying beforebabynamesimport statement an environment flag like so:# Specify desired DataFrame framework import os os.environ["DATAFRAME_FRAMEWORK"] = "pandas" # Load the package import pybabynames as bn
Development
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd pybabynames
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
python -m pip install -e '.[test]'
To run the tests:
python -m pytest
Acknowledgement
This Python package is a port of the R Data package babynames by Hadley Wickham.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybabynames-1.0.0.tar.gz.
File metadata
- Download URL: pybabynames-1.0.0.tar.gz
- Upload date:
- Size: 6.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fb9debff2ed70796ad13fba09d625907f8ac7243bf56e55e11ba2b80592c42b
|
|
| MD5 |
5a21e64d51928d1df083a61cb2a15ece
|
|
| BLAKE2b-256 |
8f7d8f902544f04fee834df73f3ecbbfa16829b23306b59345ee60a28f6ed0dc
|
File details
Details for the file pybabynames-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pybabynames-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02a754531701a7fbc1a2d94f187942bdb9740066b415c578d954133aaa436788
|
|
| MD5 |
b4dcf94e461283dfe6aa95a80e3aac00
|
|
| BLAKE2b-256 |
4041959569f508d5600a4d25f49c6dca22b55fdd7a09f1c44c83eaacc0521dc3
|