In this section we will examine some of the factors that influence population

In this section we will examine some of the factors

This preview shows page 3 - 6 out of 27 pages.

In this section, we will examine some of the factors that influence population growth and how they are changing around the world. The first table we will consider is the total population of each country over time. Run the cell below. In [4]: population = Table . read_table( ' population.csv ' ) population . show( 3 ) <IPython.core.display.HTML object> Note: The population csv file can also be found here . The data for this project was downloaded in February 2017. 0.2.1 Bangladesh In the population table, the geo column contains three-letter codes established by the Interna- tional Organization for Standardization (ISO) in the Alpha-3 standard. We will begin by taking a close look at Bangladesh. Inspect the standard to find the 3-letter code for Bangladesh. Question 1. Create a table called b_pop that has two columns labeled time and population_total . The first column should contain the years from 1970 through 2015 (includ- ing both 1970 and 2015) and the second should contain the population of Bangladesh in each of those years. In [5]: b_pop = population . where( ' geo ' , are . containing( ' bgd ' )) . drop( ' geo ' ) . where( ' time ' , are . bet b_pop Out[5]: time | population_total 1970 | 65048701 1971 | 66417450 1972 | 67578486 3
Image of page 3
1973 | 68658472 1974 | 69837960 1975 | 71247153 1976 | 72930206 1977 | 74848466 1978 | 76948378 1979 | 79141947 ... (36 rows omitted) In [6]: _ = ok . grade( ' q1_1 ' ) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Running tests --------------------------------------------------------------------- Test summary Passed: 3 Failed: 0 [ooooooooook] 100.0% passed Run the following cell to create a table called b_five that has the population of Bangladesh every five years. At a glance, it appears that the population of Bangladesh has been growing quickly indeed! In [7]: b_pop . set_format( ' population_total ' , NumberFormatter) fives = np . arange( 1970 , 2016 , 5 ) # 1970, 1975, 1980, ... b_five = b_pop . sort( ' time ' ) . where( ' time ' , are . contained_in(fives)) b_five Out[7]: time | population_total 1970 | 65,048,701 1975 | 71,247,153 1980 | 81,364,176 1985 | 93,015,182 1990 | 105,983,136 1995 | 118,427,768 2000 | 131,280,739 2005 | 142,929,979 2010 | 151,616,777 2015 | 160,995,642 Question 2. Assign b_1970_through_2010 to a table that has the same columns as b_five and has one row for every five years from 1970 through 2010 (but not 2015). Then, use that table to assign initial to an array that contains the population for every five year interval from 1970 to 2010. Finally, assign changed to an array that contains the population for every five year interval from 1975 to 2015. Hint : You may find the exclude method to be helpful ( Docs ). 4
Image of page 4
In [8]: b_1970_through_2010 = b_five . exclude( 9 ) b_1970_through_2010 Out[8]: time | population_total 1970 | 65,048,701 1975 | 71,247,153 1980 | 81,364,176 1985 | 93,015,182 1990 | 105,983,136 1995 | 118,427,768 2000 | 131,280,739 2005 | 142,929,979 2010 | 151,616,777 In [9]: b_1970_through_2010 = b_five . exclude( 9 ) initial = b_1970_through_2010 . column( ' population_total ' ) changed = b_five . exclude( 0 ) . column( ' population_total ' ) We have provided the code below that uses b_1970_through_2010 , initial , and changed in order to add a column to the table called annual_growth . Don’t worry about the calculation of the growth rates; run the test below to test your solution. If you are interested in how we came up with the formula for growth rates, consult the growth rates section of the textbook. In [10]: b_five_growth = b_1970_through_2010 . with_column( ' annual_growth ' , (changed / initial) **0.
Image of page 5
Image of page 6

You've reached the end of your free preview.

Want to read all 27 pages?

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes