- Demonstrate "complex" analysis notebook.
- Load data
- Talk about the optional parameter
index_col=
- Talk about the optional parameter
- Walk through the gapminder_all data.
- Plot 1957 life-expectancy against GDP/pop
- Note the column-as-attribute syntax
- Note outlier
- data.gdpPercap_1957.argmax()
- data.drop(...)
- Plot Africa data alone
- Use data[data.continent == 'Africa'] syntax
- Plot with a color
- CHALLENGE: Select the subset of the data from the continent which contains the country with the maximum life-expectancy in 1967
-
Talk about wanting to repeat something for each continent.
-
For loop syntax
-
CHECK YOUR UNDERSTANDING:
Fill in the blanks in the program below so that it prints “nit” (the reverse of the original character string “tin”).
original = "tin" result = ____ for char in original: result = ____ print(result)
-
Plot only a subset of the continents (africa, asia, europe)
- Talk about wanting to do something different depending on which continent we're considering.
- If statement syntax (notice the 'block' syntax)
- if
- if, else
- if, elif, else
- Plot a different color for several of the continents.
- Add x/y axis labels
- Add a title
- Size the points by np.sqrt(population) (so that the area is proportional)
- Add a legend (dummy plotting)
- Note the uglyness of the numbers
- Celsius to fahrenheit conversion
- Kelvin to C conversion
- Talk about function composition
- What are the benefits of using functions?
- Let's write a function to convert large numbers into scientific notation
- Add an optional argument to set the precision
- Add some documentation and show how help(scientific_notation) works
- How do we know if it's working? (unit testing, assert)
- Line of best fit
- Statsmodels
- formula
- fitting the model and viewing the summary
- Getting the coefficients out and using them
- Plotting the line
- CHALLENGE: extend this analysis and share with your neighbors