# helper function import
from helper import *
The data used in the analysis of prison escapes by means of helicopter is from a Wikipedia article titled 'List of Helicopter Prison Escapes' and can be found here:
https://en.wikipedia.org/wiki/List_of_helicopter_prison_escapes
The intent of the analysis is to:
url = 'https://en.wikipedia.org/wiki/List_of_helicopter_prison_escapes'
data = data_from_url(url)
All elements of the first row of the dataset was printed to verify that the correct Wikipedia data was pulled from the 'url' cited in the previous cell.
print(data[:1])
[['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]"]]
The dataset was modified to remove the last element of each row which is the long-text information in the 'Details' column; this action was performed to "clean-up" the data. The first three rows of the dataset are printed to demonstrate this action.
index = 0
for row in data:
data[index] = row[:-1]
index += 1
print(data[:3])
[['August 19, 1971', 'Santa Martha Acatitla', 'Mexico', 'Yes', 'Joel David Kaplan Carlos Antonio Contreras Castro'], ['October 31, 1973', 'Mountjoy Jail', 'Ireland', 'Yes', "JB O'Hagan Seamus TwomeyKevin Mallon"], ['May 24, 1978', 'United States Penitentiary, Marion', 'United States', 'No', 'Garrett Brock TrapnellMartin Joseph McNallyJames Kenneth Johnson']]
The dataset's first element for each row, the 'Date' column, was modified from the 'Month, Day, Year" format to only display the year (yyyy) each helicopter prison escape took place as the analysis is only concerned with the year each prison escape attempt took place. The first row of the datast was printed to confirm the modification.
for row in data:
date = fetch_year(row[0])
row[0] = date
print(data[:1])
[[1971, 'Santa Martha Acatitla', 'Mexico', 'Yes', 'Joel David Kaplan Carlos Antonio Contreras Castro']]
The following three cells create a new list to demonstrate which year(s) had the most helicopter prison break attempts in the format [yyyy, n], where 'n' equals the total number of attempts per year. The final list will include years that had no prison escapes as well.
# Range of all years from the first registered attempt until the last.
min_year = min(data, key=lambda x: x[0])[0]
max_year = max(data, key=lambda x: x[0])[0]
print('Range of all years from the first registered helicopter prison escape attempt until the last.')
print(min_year, 'to', max_year)
Range of all years from the first registered helicopter prison escape attempt until the last. 1971 to 2020
# List of all years from min_year to max_year.
years = []
for yr in range(min_year, max_year + 1):
years.append(yr)
print('List of all years within the range of years determined in the cell above.')
print(years)
List of all years within the range of years determined in the cell above. [1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020]
# modify years[] to create attempts_per_year[] with [<year>, 0] format.
attempts_per_year = []
for yr in years:
attempts_per_year.append([yr, 0])
for row in data:
for apy in attempts_per_year:
yr = apy[0]
if row[0] == yr:
apy[1] += 1
print('Helicopter prison escape attempts per year from 1971 to 2020')
print(attempts_per_year)
Helicopter prison escape attempts per year from 1971 to 2020 [[1971, 1], [1972, 0], [1973, 1], [1974, 0], [1975, 0], [1976, 0], [1977, 0], [1978, 1], [1979, 0], [1980, 0], [1981, 2], [1982, 0], [1983, 1], [1984, 0], [1985, 2], [1986, 3], [1987, 1], [1988, 1], [1989, 2], [1990, 1], [1991, 1], [1992, 2], [1993, 1], [1994, 0], [1995, 0], [1996, 1], [1997, 1], [1998, 0], [1999, 1], [2000, 2], [2001, 3], [2002, 2], [2003, 1], [2004, 0], [2005, 2], [2006, 1], [2007, 3], [2008, 0], [2009, 3], [2010, 1], [2011, 0], [2012, 1], [2013, 2], [2014, 1], [2015, 0], [2016, 1], [2017, 0], [2018, 1], [2019, 0], [2020, 1]]
%matplotlib inline
barplot(attempts_per_year)
The most helicopter prison break attempts took place in the years 1986, 2001, 2007, and 2009 with three attempts in each year respectively.
Table 1 organizes the data to demonstrate how many helicopter prison escape attempts have occured in each country where an attempt was registered from 1971 to 2020.
countries_frequency = df["Country"].value_counts()
print_pretty_table(countries_frequency)
print('Table 1: Number of Helicopter Prison Escape Attempts per Country')
Country | Number of Occurrences |
---|---|
France | 15 |
United States | 8 |
Belgium | 4 |
Canada | 4 |
Greece | 4 |
Brazil | 2 |
Australia | 2 |
United Kingdom | 2 |
Netherlands | 1 |
Chile | 1 |
Russia | 1 |
Puerto Rico | 1 |
Mexico | 1 |
Italy | 1 |
Ireland | 1 |
Table 1: Number of Helicopter Prison Escape Attempts per Country
The most helicopter brison break attempts from 1971 to 2020 have occured in France with 15 attempts total.