20+ Health Related Data Sets In A Single Line of Code

coding + programming data python Nov 29, 2022
Healthcare data robots holding hands.

TLDR: here are 20+ interesting and easily loadable health-related datasets for you to begin exploring right away.


Finding good health-related datasets to be explored is not an easy task... It often takes a lot of searching and digging until you find something that is trustworthy, insightful, and - most importantly - actionable.

In this article, I present a few favorite health-related data sources. For more on this topic see the related article 10 + Health Related Data Visuals In A Single Line of Code.

It is worth mentioning that - I handpicked these datasets based on their ease of use in order to allow you to easily load them with only a single line of code.

"Getting a data" quick and easily for training, testing, demonstration, or education purposes is handy.

Needless to say, loading data with only a single line of code brings a couple of particular limitations (none of them grave, but worth mentioning anyway). I discuss these limitations at the bottom of the article.

All in all, I hope this article will be extremely useful for you, so without further ado, let's get started:

Standard Data Science Python Imports

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import requests

1-3 HealthData.gov

If you are looking for fascinating and thought-provoking datasets on all sorts of health-related topics, you have to check out Healthdata.gov.

The website is run by the US Department of Health, and its goal is to make health data publicly available and easily accessible to citizens and decision-makers in the business world.

Most of their datasets come with dozens of columns and variables to be explored about a particular topic, perfect for deeply exploring topics and seeing where your curiosity takes you.

Below, let's load a few of their datasets in a single line of code.

Maltreatment & Abuse Data


For the result (excerpted):

Child Abuse Data


For the result (excerpted):

Child Abuse Relationship Data


For the result (excerpted):

4-9 Humanitarian Data Exchange

The Humanitarian Data Exchange is an open-source data-sharing platform created by the United Nations Office for the Coordination of Humanitarian Affairs - or OCHA for short - in order to spread awareness about key humanitarian initiatives.

As of this writing, they have more than 20,000 publicly available datasets, and in all fairness, this number is likely to continue growing as more and more people upload their contributions.

Natural Disasters Data


For the result (excerpted) (note the abundant NaN values):

 Volcano Population Exposure

The Population Exposure Index - or PEI for short - is a widely used index for estimating the potential risk of a given volcano.

In (very) simplistic terms, this index is calculated by weighing the number of people who live nearby a particular volcano against the historical radius of damage of its past eruptions.


For the result (excerpted):

Healthcare In Ukraine 

Attacks on Ukrainian Healthcare Facilities since the start of the 2021/2022 war.


For the result (excerpted):

 Aid effectiveness in Ukrain.


For the result (excerpted): 

Ukrainian Health Indicators by year.


Threats to Aid Workers.

Aid workers killed, injured, kidnapped and arrested in 2022.


For the result (excerpted):

10-11 Seaborn Datasets

This dataset collection is the one used by Seaborn - one of the most widely used python data visualization libraries - according to their official documentation.

Have in mind that the Seaborn dataset collection is large. There are data from other topics of interest. Here we focus on health data.

Below, I will provide you with two ways of loading the data. First, by using the seaborn built-in load_dataset method, and lastly, by loading directly from their GitHub repository.

Attention & Test Scores

Option one from the GitHub repo. Test score by attention type.


Option two, from the sns.load_dataset() method.

df = sns.load_dataset('attention')

Both for the result (excerpted):

Brain Networks

df = sns.load_dataset('brain_networks')



Both for the result (excerpted):

12-13 Data USA

Data USA is a platform to distribute, download, and create in-browser visualizations of US government data. Created in partnership with Deloitte - one of the world's top consulting firms - and the Massachusetts Institute of Technology to help everyday people have access to trustworthy data.

Much of this data won't be readily available in csv or xlsx format for you to easily download. So first, you will have to use the requests.get method to parse their page content into a pd.DataFrame object.

So with that in mind, let's load some of their datasets with only a single line of code.

Health Professionals Data


 For the result (excerpted):

 From this same source and service we can also gram information about foreign healthcare professionals working in the US.

+'Birthplace&measures=Total Population,ycbpop RCA,'\
+'Record Count&Nativity=2&Workforce Status='\
+'true&properties=Country Code&Record Count>=5'

 For the result (excerpted):

 14-22 CORGIS Data Project

The CORGIS project (short for Collection of Real-World, Great, Interesting, dataSets) aggregates cool and interesting datasets from all over the internet and makes them easily downloadable.

More than a handful of brilliant minds from Virginia Tech are behind this project, and there are dozens of datasets in a myriad of topics available for download.

So if you are looking for a dataset to explore and work on your next project, please check them out.

Below, I will give you the line of code necessary to import the datasets from the CORGIS GitHub page and also point you to the original source.


Evolution of coronavirus cases and deaths.

# Originally sourced from 
# https://data.europa.eu/
# euodp/en/data/dataset/
# covid-19-coronavirus-data


 For the result (excerpted):

COVID related behavior tracking survey.

# Sourced from 
# https://github.com/
# YouGov-Data/covid-19-tracker


For the result (excerpted):

Mobility trends during COVID.

# Sourced from 
# https://github.com/
# owid/owid-datasets/
# tree/master/datasets/
# Google%20Mobility%20Trends%20(2020)


Non-Covid Diseases

Non-covid diseases (world-wide).

# Sourced from 
# https://aidsinfo.unaids.org/


For the result (excerpted):

Non-covid diseases (United States).


For the result (excerpted):

United States cancer data and statistics.

# Originally sourced from 
# https://www.socialexplorer.com/explore-tables


Drug Usage

General drug usage rates across the United States.

# Originally sourced from 
# https://pdas.samhsa.gov/#/


For the result (excerpted):

Opioid use data across the United States.

# Originally sourced from 
# https://nida.nih.gov/
# research-topics/
# trends-statistics/overdose-death-rates


 For the result (excerpted):

 Work Related Injuries

# Originally sourced from
# https://www.osha.gov/
# ords/odi/establishment_search.html


For the result (excerpted):


This article has at least a few limitations and caveats. Here are some of them.

  • Style - The code examples in this article break many coding style conventions. Do not use this article as a model for style.
  • Line Continuation - For many examples this article uses line continuation. In Python the backslash \ assists with line continuation. Line wrap (or line continuation), for purposes of this article, does not count as a second line of code.
  • String Concatenation - In order to make the code look good here on this platform and to avoid odd line-wrapping the article also uses string concatenation in a multiple places.
  • Indexing Lists + Tables - As you can read in the documentation for pd.read_html() this code returns a list of Pandas data frames. The list index in square brackets following pd.read_html()[i], here where i represents an index on the list is what finds the data frame of interest.
  • This article also uses requests.get().json() or requests.get().json()[data] to grab and identify json data from online. In a few examples here, this square bracket notation isolates the data of interest.

 Thanks for reading!

Learn Data Science For Free. Now Offering Live Free Online Data Science Lessons.


Get You're Free Lesson Here