Midterm exam - Python component

Problem 1

Use Quandl with your API key to get annual data on US GDP (Quandl code: FRED/GDP, Collapse: annual).

  • What was the percentage change of GDP on 1997?
  • Plot the distribution of percentage changes in GDP.

Problem 2

names = ["Patrick","Xavier","Abigayle"]

  • Print the first character in each name from the names list above using for loop.
  • Complete the task using while loop as well.

Problem 3

Define a function that will take a list of 5 numbers as input and calculate average of the last 3.

Problem 4

Download the Superstore.xlsx file from Moodle and read it using pandas. Calculate the percentage of orders that have First Class shipping mode.

Problem 5

Use the same dataset from Problem 4. Create a new column Segment_codes in the dataframe that will have value 1, if the customer is Individual and 0 otherwise (Corporate).