Skip to content

Instantly share code, notes, and snippets.

@barentsen
Created April 1, 2016 18:53
Show Gist options
  • Save barentsen/1267b3956d25d26ad1a09544badeb067 to your computer and use it in GitHub Desktop.
Save barentsen/1267b3956d25d26ad1a09544badeb067 to your computer and use it in GitHub Desktop.
Compute the median radius of all confirmed Kepler planets using Python and the NASA Exoplanet Archive.
"""Compute the median radius of all confirmed Kepler planets."""
import pandas as pd
# Fetch the table of confirmed exoplanets from NExSci
planets = pd.read_csv('http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=*')
# Select the Kepler planets
kepler_planets = planets[planets.pl_kepflag == 1]
# Do your statistics
print(kepler_planets.pl_rade.median())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment