from helper import *
Now, let's get the data from the List of helicopter prison escapes Wikipedia article.
url = 'https://en.wikipedia.org/wiki/List_of_helicopter_prison_escapes#Actual_attempts'
data = data_from_url(url)
for row in data[0:3]:
print(row)
index = 0
for row in data:
data[index]=row[:-1]
index += 1
print(data[0:3])
for row in data:
date = fetch_year(row[0])
row[0] = date
print(data[0:3])
min_year = min(data, key=lambda x: x[0])[0]
max_year = max(data, key=lambda x: x[0])[0]
print(min_year)
print(max_year)
years = []
for y in range(min_year, max_year + 1):
years.append(y)
print(years)
attempts_per_year = []
for year in years:
attempts_per_year.append([year,0])
print(attempts_per_year)
for row in data:
for y in attempts_per_year:
if row[0] == y[0]:
y[1] += 1
print(attempts_per_year)
%matplotlib inline
barplot(attempts_per_year)
countries_frequency = df["Country"].value_counts()
print_pretty_table(countries_frequency)
ef = pd.read_html("https://en.wikipedia.org/wiki/List_of_helicopter_prison_escapes")[1]
ef = ef[["Date", "Prison name", "Country", "Succeeded", "Escapee(s)"]]
countries_y = ef["Date"].value_counts()
print(countries_y)