The usdatasets package provides a comprehensive collection of datasets focused on the United States, designed for data analysis, education, and research in Python. It includes extensive data on topics such as crime and public safety, political history, economic indicators, education, public health, natural disasters, demographics, infrastructure, sports, and cultural events.
The collection covers diverse data types, including historical political records, crime statistics, wage and income data, election results, mortality rates, presidential information, educational metrics, environmental incidents, asylum records, firefighter fatalities, terrorist activity, NFL statistics, stock market data, and entertainment industry records.
You can install the usdatasets package from PyPI:
pip install usdatasetsimport usdatasets as usd
# List all available datasets
datasets = usd.list_datasets()
print(datasets)
# Load a specific dataset
df = usd.load_dataset('crime_and_incarceration_by_state')
print(df.head())| Dataset | Description | Period |
|---|---|---|
wages_by_education |
Hourly wages by education level and gender | 1973-2022 |
college_school_wage |
Wage comparison: college vs high school | 1973-2022 |
counties_per_capita_income |
Counties by per capita income | Current |
google_stock_price |
Google/Alphabet stock price data | Historical |
The usdatasets library is released under the MIT License, allowing free use for both commercial and non-commercial purposes.