text: #!/usr/bin/env python
  # coding: utf-8
  
  # ## Problem 2 - Plotting temperatures 
  # 
  # In this problem we will  plot monthly mean temperatures from the Helsinki-Vantaa airpot for the past 30 years.
  # 
  # ## Input data
  # 
  # File `data/helsinki-vantaa.csv` monthly average temperatures from Helsinki Vantaa airport. Column descriptions:
  # 
  # ### Part 1
  # 
  # Load the Helsinki temperature data (`data/helsinki-vantaa.csv`)
  # 
  # - Read the data into variable called `data` using pandas
  # - Parse dates from the column `'DATE'` and set the dates as index in the dataframe 
  
  # YOUR CODE HERE 1 to read the data into data and parse dat
  import pandas as pd
  fp='data/helsinki-vantaa.csv'
  data=pd.read_csv(fp,parse_dates=['DATE'],index_col='DATE')
  # This test print should print first five rows
  print(data.head())
  
  # Check the number of rows in the data frame
  print(len(data))
  
  # ### Part 2
  # 
  # Select data for a 30 year period (January 1988 - December 2018)
  # 
  # - Store the selection in a new variable `selection`
  
  # YOUR CODE HERE 2
  selection=data.loc[(data.index>='1988-01-01')&(data.index<'2018-12-31')]
  # Check that the data was read in correctly:
  selection.head()
  
  # Check how many rows of data you selected:
  print("Number of rows:", len(selection))
  
  
  # ### Part 3
  # 
  # #### Part 3.1
  # 
  # Create a line plot that displays the temperatures (`TEMP_C`) for yeach month in the 30 year time period:
  #      
  # #### Part 3.2
  # 
  # Save your figure as PNG file called `temp_line_plot.png`.
  # 
  
  # YOUR CODE HERE 3
  import matplotlib.pyplot as plt
  selection=selection.sort_index()
  
  plt.plot(selection.index,selection['TEMP_C'],linestyle='solid',c='black',markersize=3)
  plt.title("Helsinki-Vantaa Airport")
  plt.set_xlabel('Time')
  plt.set_ylabel('Temperature(Celsius)')
  plt.grid()
  # Set output file name
  outputfp = "temp_line_plot.png"
  
  
  
  # Save plot as image
  # YOUR CODE HERE 4
  plt.savefig(outputfp)
  
  import os
  
  #Check that output file exists (also open the file and check that the plot looks ok!)
  os.path.exists(outputfp)
  
  
  # **REMINDER**: Don't forget to upload your figure and the modified notebook into your personal GitHub repository!
  # 
  # ### Done!
  