First Question: In which year did the most helicopter prison break attempts occur?
Second Quesion: In which countries do the most attempted helicopter prison escapes occur?
We begin by importing some helper functions.
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"
data = data_from_url(url)
print(data[0])
['August 19, 1971', 'Santa Martha Acatitla', 'Mexico', 'Yes', 'Joel David Kaplan Carlos Antonio Contreras Castro', "Joel David Kaplan was a New York businessman who had been arrested for murder in 1962 in Mexico City and was incarcerated at the Santa Martha Acatitla prison in the Iztapalapa borough of Mexico City. Joel's sister, Judy Kaplan, arranged the means to help Kaplan escape, and on August 19, 1971, a helicopter landed in the prison yard. The guards mistakenly thought this was an official visit. In two minutes, Kaplan and his cellmate Carlos Antonio Contreras, a Venezuelan counterfeiter, were able to board the craft and were piloted away, before any shots were fired.[9] Both men were flown to Texas and then different planes flew Kaplan to California and Castro to Guatemala.[3] The Mexican government never initiated extradition proceedings against Kaplan.[9] The escape is told in a book, The 10-Second Jailbreak: The Helicopter Escape of Joel David Kaplan.[4] It also inspired the 1975 action movie Breakout, which starred Charles Bronson and Robert Duvall.[9]"]
last index of above array has more details so will remove it.
index = 0
for el in data:
data[index] = el[:-1]
index = index + 1
Print first row to check
print(data[0])
['August 19, 1971', 'Santa Martha Acatitla', 'Mexico', 'Yes', 'Joel David Kaplan Carlos Antonio Contreras Castro']
Change date column to be just a year.
for el in data:
el[0] = fetch_year(el[0])
print(data[0])
[1971, 'Santa Martha Acatitla', 'Mexico', 'Yes', 'Joel David Kaplan Carlos Antonio Contreras Castro']
First define min and max year in data
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)
1971 2020
Second make table with year and attempts occur columns
attempts_per_year = []
for y in range(min_year, max_year + 1):
attempts_per_year.append([y,0])
print(attempts_per_year)
[[1971, 0], [1972, 0], [1973, 0], [1974, 0], [1975, 0], [1976, 0], [1977, 0], [1978, 0], [1979, 0], [1980, 0], [1981, 0], [1982, 0], [1983, 0], [1984, 0], [1985, 0], [1986, 0], [1987, 0], [1988, 0], [1989, 0], [1990, 0], [1991, 0], [1992, 0], [1993, 0], [1994, 0], [1995, 0], [1996, 0], [1997, 0], [1998, 0], [1999, 0], [2000, 0], [2001, 0], [2002, 0], [2003, 0], [2004, 0], [2005, 0], [2006, 0], [2007, 0], [2008, 0], [2009, 0], [2010, 0], [2011, 0], [2012, 0], [2013, 0], [2014, 0], [2015, 0], [2016, 0], [2017, 0], [2018, 0], [2019, 0], [2020, 0]]
Last insert number of attempts occur per year
for el in data:
for ya in attempts_per_year:
if el[0] == ya[0]:
ya[1] += 1
visualize the attempts per year
%matplotlib inline
barplot(attempts_per_year)
the most attempts at breaking out of prison with a helicopter occur in 1986, 2001, 2007 and 2009, it was 3 attempts for each year.
countries_frequency = df["Country"].value_counts()
print_pretty_table(countries_frequency)
Country | Number of Occurrences |
---|---|
France | 15 |
United States | 8 |
Belgium | 4 |
Greece | 4 |
Canada | 4 |
Australia | 2 |
United Kingdom | 2 |
Brazil | 2 |
Ireland | 1 |
Puerto Rico | 1 |
Netherlands | 1 |
Chile | 1 |
Russia | 1 |
Mexico | 1 |
Italy | 1 |
The most attempted helicopter prison escapes occur in France