Import helper functions
from helper import *
Obtain the data from the Wikipedia article List of helicopter prison escapes
Print the 1st row to become familiar with data.
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]"]
From the 1st row of the data, the last column contains details that are not needed for this analysis. Therefore, the last column will be excluded and only the 1st 5 columns will be used.
index=0
for row in data:
row[0]=fetch_year(row[0]) #replace the MMDDYYYY date with the year only
data[index]=row[0:5] #exclude the last row, which are details about the escapes
index+=1
print(data[0:3])
[[1971, 'Santa Martha Acatitla', 'Mexico', 'Yes', 'Joel David Kaplan Carlos Antonio Contreras Castro'], [1973, 'Mountjoy Jail', 'Ireland', 'Yes', "JB O'Hagan Seamus TwomeyKevin Mallon"], [1978, 'United States Penitentiary, Marion', 'United States', 'No', 'Garrett Brock TrapnellMartin Joseph McNallyJames Kenneth Johnson']]
Print a list consisting of the prison escape years from min to max
min_year = min(data, key=lambda x: x[0])[0]
max_year = max(data, key=lambda x: x[0])[0]
attempts_per_year = []
for y in range(min_year, max_year + 1):
attempts_per_year.append([y,0]) #loop through data to append year to attmepts per year
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]]
Determine the number of attempted helicopter prison escapes per year
for row in data:
for ya in attempts_per_year:
y=ya[0]
if row[0] == y:
ya[1] += 1
print(attempts_per_year)
[[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]]
Plot the number of attempted escaptes
Create a bar plot of the number of helicopter escape attempts per year to determine which year had the highest number of attempted escapes.
%matplotlib inline
barplot(attempts_per_year)
The most helicopter attempted breakouts occurred in 1986, 2001, 2007, and 2009.
Which countries had the highest helicopter prison escape attempts
countries_frequency = df["Country"].value_counts()
print_pretty_table(countries_frequency)
Country | Number of Occurrences |
---|---|
France | 15 |
United States | 8 |
Greece | 4 |
Belgium | 4 |
Canada | 4 |
Brazil | 2 |
United Kingdom | 2 |
Australia | 2 |
Mexico | 1 |
Netherlands | 1 |
Italy | 1 |
Chile | 1 |
Russia | 1 |
Ireland | 1 |
Puerto Rico | 1 |
France by far has the highest number of attempted helicopter prison breaks. Just about twice as many as the country, United States, of the next highest number of escapes.
How many helicopter prison escapes were successful
successful_attempts = df['Succeeded'].value_counts()
print(successful_attempts)
Yes 34 No 14 Name: Succeeded, dtype: int64
Wow, out of the 48 attempted helicopter prison escapes, 34 were successful!
Are there any escapees that attempted more than one prison break
escapee=[] #create empty list for name of escapees
for row in data: #loop through data
name=row[4]
escapee.append([name,0]) #append names of escapees to escapee list
for name in escapee: #loop through escapee list and increment number of escapes
y=name[0]
if row[4]==y:
name[1]+=1
print(escapee)
[['Joel David Kaplan Carlos Antonio Contreras Castro', 1], ["JB O'Hagan Seamus TwomeyKevin Mallon", 1], ['Garrett Brock TrapnellMartin Joseph McNallyJames Kenneth Johnson', 1], ['Gérard DupréDaniel Beaumont', 1], ['Marina Paquet (hijacker)Giles Arseneault (prisoner)', 1], ['David McMillan', 1], ['James Rodney LeonardWilliam Douglas BallewJesse Glenn Smith', 1], ['José Carlos dos Reis Encina, a.k.a. "Escadinha"', 1], ['Michel Vaujour', 2], ['Samantha Lopez', 1], ['André BellaïcheGianluigi EspositoLuciano Cipollari', 1], ['Sydney DraperJohn Kendall', 1], ['Mahoney Danny Francis MitchellRandy Lackey', 1], ['Ben Kramer', 1], ['Ralph BrownFreddie Gonzales', 1], ['Robert FordDavid Thomas', 1], ['William Lane', 1], ['—', 7], ['—', 6], ['Michel Vaujour', 1], ['Four members of the Manuel Rodriguez Patriotic Front', 1], ['—', 5], ['John Killick', 1], ['Steven Whitsett', 1], ['—', 4], ['Pascal Payet', 2], ['Abdelhamid CarnousEmile Forma-SariJean-Philippe Lecase', 1], ['—', 3], ['—', 2], ['Orlando Cartagena Jose Rodriguez Victor Diaz Hector Diaz Jose Tapia', 1], ['Eric AlboreoFranck PerlettoMichel Valero', 1], ['—', 1], ['Hubert SellesJean-Claude MorettiMohamed Bessame', 1], ['Vassilis Paleokostas', 1], ['Eric Ferdinand', 1], ['Pascal Payet', 1], ['Nordin Benallal', 1], ['Vasilis PaleokostasAlket Rizai', 1], ['Alexin JismyFabrice Michel', 1], ['Ashraf Sekkaki plus three other criminals', 1], ['Brian Lawrence', 1], ['Alexey Shestakov', 1], ['Panagiotis Vlastos', 1], ['Benjamin Hudon-BarbeauDanny Provençal', 1], ['Yves DenisDenis LefebvreSerge Pomerleau', 1], ['Pola RoupaNikos Maziotis', 1], ['Rédoine Faïd', 1], ['Kristel A.', 1]]
Plot number of escapee attempts
Graph number of times each escapee attempted to escape
%matplotlib inline
barplot(escapee)
Fortunately, each escapee only attempted an escape once.