#!/usr/bin/env python # coding: utf-8 # In[1]: from helper import * # In[2]: url = 'https://en.wikipedia.org/wiki/List_of_helicopter_prison_escapes' # In[15]: data = data_from_url(url) # In[17]: print(data[0][0]) # In[23]: index=0 for row in data: row = row[:5] data[index] = row index +=1 # In[26]: for row in data: year = fetch_year(str(row[0])) row[0]=year print(data[:3]) # new_data=[] # for row in data: # new_data.append(row[0]) # print(new_data) # In[65]: 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) # In[86]: years = [] for y in range(min_year, max_year + 1): years.append(y) # In[94]: attempts_per_year = [] for y in years: attempts_per_year.append([y, 0]) print(attempts_per_year) # In[93]: for row in data: for ya in attempts_per_year: if ya[0] == row[0]: ya[1]+=1 print(attempts_per_year) # In[97]: get_ipython().run_line_magic('matplotlib', 'inline') barplot(attempts_per_year) # In[98]: countries_frequency = df["Country"].value_counts() # In[99]: print(countries_frequency) # In[100]: print_pretty_table(countries_frequency) # In[ ]: