Last active
May 29, 2018 04:33
-
-
Save cab938/2161800beb95d3f9c36a0ef6c346fd35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!pip install html5lib #install html5lib, only needs to be run once | |
import pandas as pd | |
import numpy as np | |
df=pd.read_html('https://proxy.mentoracademy.org/getContentFromUrl/?userid=brooks&url=https://en.wikipedia.org/wiki/List_of_natural_satellites', header=0) | |
moons=df[4][1:] #drop prehistoric moon sighting | |
moons=moons['Discovery year'] #we are only interested in the year discovered | |
moons=moons.apply(lambda x: x.split('/')[0]).astype(int) #clean dataframe to just years as ints | |
pre_2000=len(moons[moons<2000]) #select only that data from moons which is less than 2000 | |
post_2000=len(moons[moons>=2000]) #select only that data from moons which is greater than or equal to 2000 | |
size_ratio=post_2000/pre_2000 | |
print(size_ratio) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment