Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. def population_for_country_in_year(country, year):
  2. """Optional: Define a function to return the population
  3. of a country in a year using a row from the poverty table."""
  4. geo = countries.where("name", are.equal_to(country)).column(0).item(0)
  5. country_pop = population.where("geo", are.equal_to(geo))
  6. country_pop_in_year = country_pop.where("time", are.equal_to(year)).column(2).item(0)
  7. return country_pop_in_year
  8.  
  9. def poverty_for_country_in_year(country, year)
  10. geo = countries.where("name", are.equal_to(country)).column(0).item(0)
  11. country_poverty = poverty.where("geo", are.equal_to(geo))
  12. country_poverty_in_year = country_poverty.where("time", are.equal_to(year)).column(2).item(0)
  13. return country_poverty_in_year
  14.  
  15. def population_living_in_poverty
  16. """Poverty Percent * Population of Country in Year"""
  17. return population_for_country_in_year(country, year)*poverty_for_country_in_year(country,year)
  18.  
  19. def poverty_timeline(country):
  20. """Draw a timeline of people living in extreme poverty in a country."""
  21. geo = countries.where("name", are.equal_to(country)).column(0).item(0)
  22. country_poverty = poverty.where("geo", are.equal_to(geo))
  23. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement