DS100-2
Completion 1.3 (D)
APPLIED DATA SCIENCE
PYTHON DATA SCIENCE TOOLBOX
Name:
MONTILLA, Vince Ivan Jon S. Page 1 of 4
Write codes in Jupyter notebook as required by the problems. Copy both code and output as screen grab or screen shot and paste
them here.
Datasets Needed for this Task:
1. cars.csv
2. weather_data_austin_2010.csv
1 Create a list of lists. The individual lists should contain, in the correct order, the weight (in pounds), the height (in inches),
and the age of the baseball players.
Ages: 24 27 24 27 25 35 28 23 23 26
Weights: 188 180 185 160 180 185 189 185 219 230
Heights: 73 73 74 74 69 70 73 75 78 79
Convert the list of lists into a NumPy array named np_baseball. Using NumPy functionality, convert the unit of height to
m and that of weight to kg. Print the resulting array.
Code and Output
2 Refer to the code in #1. Write a code that determines the age of the 6th player. The output should be in the following form:
The 5th player is <age> years old.
Code and Output
3 Refer to the code in #1. Print out the ages of the young players (those who are 24 years old and below).
Code and Output
Page 1 of 4
4 Create a line plot showing the yearly CO2 emissions per person in Vietnam. Make sure to add labels and a title to your plot.
CO2 Emissions per country per year (tons per person)
country 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014
Brunei 13.9 13.7 13.1 22.5 24 20.5 21.1 24.6 24.2 19.2 22.1
Cambodia 0.187 0.209 0.223 0.253 0.281 0.33 0.35 0.358 0.369 0.373 0.438
Indonesia 1.51 1.51 1.5 1.61 1.76 1.87 1.77 2.46 2.56 1.95 1.82
Lao 0.246 0.244 0.265 0.153 0.156 0.204 0.262 0.256 0.265 0.243 0.297
Malaysia 6.51 6.8 6.41 6.94 7.53 7.2 7.77 7.7 7.5 7.96 8.03
Myanmar 0.259 0.239 0.263 0.262 0.198 0.205 0.25 0.283 0.217 0.25 0.417
Philippines 0.875 0.867 0.771 0.808 0.869 0.841 0.905 0.897 0.942 0.996 1.06
Singapore 6.52 6.76 6.68 4.21 7.45 11.3 11 8.74 6.9 10.4 10.3
Thailand 3.74 3.78 3.83 3.81 3.79 4 4.19 4.12 4.37 4.4 4.62
Vietnam 1.08 1.16 1.21 1.22 1.36 1.47 1.61 1.7 1.57 1.61 1.8
Code and Output
Page 2 of 4
5 Based on the plot, in approximately what year was the six billion
population reached?
2000
6 Visualize Life Expectancy as a function of GDP per Capita for the following South East Asia countries. Use Child Mortality as
an additional argument. Do not forget to label the axes and to add a title.
Fertility Life Expectancy Population Child Mortality GDP Per Capita
Philippines 3.151 68.207 93.2 31.9 5614
Thailand 1.443 73.852 69.1 14.5 12822
Singapore 1.261 81.788 50.9 2.8 72056
Vietnam 1.82 75.49 87.8 24.8 4486
Indonesia 2.434 70.185 239.9 33.1 8498
Malaysia 2.001 74.479 48.0 8.3 20398
Code and Output
7 Import cars.csv. Use the country abbreviations as index. Print the first four lines.
Code and Output
Page 3 of 4
8 Refer to the cars dataset. Create a code that prints out the country name and the number of cars per capita in India,
Japan and Egypt.
Code and Output
9 Refer to the cars dataset. Create a code that prints out the observations for the countries with few of cars (cars per capita
less than 100).
Code and Output
10 Import weather_data_austin_2010.csv. Make sure to use a DateTimeIndex. Extract the Temperature
column and save the result to temp0. Extract data from temp0 for a single hour – the hour from 9 pm to 10 pm on
October 11, 2010. Assign the data to temp1. Print temp0 and temp1.
Code and Ouput
Page 4 of 4