Professional Documents
Culture Documents
GARCIA, Jason Worksheet 1.3
GARCIA, Jason Worksheet 1.3
3
DS100-2
PYTHON DATA SCIENCE TOOLBOX
APPLIED DATA SCIENCE
Name:
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.
1 Create a list of lists. The individual lists should contain, in the correct order, the age, the height (in inches), and the weight
(in pounds) of the baseball players.
Ages: 24 27 24 27 28 35 28 23 23 26
Heights: 188 180 185 160 180 185 189 185 219 230
Weights: 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 4th player. The output should be in the following form:
The 4th 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 26 years old and below).
Page 1 of 5
Code and Output
4 Create a line plot showing the yearly CO2 emissions per person in Lao. Make sure to add labels and a title to your plot.
Page 2 of 5
4. Code and output
Page 3 of 5
5 Visualize Fertility as a function of GDP per Capita for the following South East Asia countries. Use Population as an additional
argument. Do not forget to label the axes and to add a title.
6 Import cars.csv. Use the country abbreviations as index. Print the last two lines.
Code and Output
Page 4 of 5
7 Refer to the cars dataset. Create a code that prints out the country name and whether the country drives on the right-
hand-side in Japan, India and Russia.
Code and Output
8 Refer to the cars dataset. Create a code that prints out the observations for the countries with lots of cars (cars per
capita greater than 500).
Code and Output
Page 5 of 5