In [10]: # -*- coding: utf-8 -*-

    ...: import numpy as np

    ...: import pandas as pd

    ...: import matplotlib.pyplot as plt

    ...: import random

    ...:

    ...: df = pd.read_csv ('/home/jeet/Desktop/Data-store/temperature-maximum-1901-2011.csv',encoding="cp1252")

    ...:

    ...: print("\n------- output data :-----------\n")

    ...: print("Temperature Data Analysis (1901 to 2011):")

    ...: print("\n-----------------------------------\n")

    ...:

    ...: # Question – A : get row and column numbers

    ...:

    ...: print("Dimension of the data frame = ",df.shape)

    ...:

    ...: # Question – B : print column names :

    ...:

    ...:

    ...: print('--------------------------------------------\n')

    ...: print('Column names as follows :\n')

    ...: print('------------------------\n')

    ...: count = 0

    ...: for col in df.columns:

    ...: print(count,"-->",col)

    ...: count = count+1

    ...: print("\n-----------------------------\n")

    ...:

    ...: x = df['YEAR']

    ...: y1 = df['ANNUAL']

    ...: y2 = df['JAN-FEB']

    ...: y3 = df['MAR-MAY']

    ...: y4 = df['JUN-SEP']

    ...: y5 = df['OCT-DEC']

    ...:

    ...: # Question - C : Annual data plotting

    ...:

    ...: plt.title('Annual temperature ( 1901 to 2011 ):')

    ...: plt.xlabel('year -->')

    ...: plt.ylabel('temp -->')

    ...: plt.plot(x,y1)

    ...: plt.show()

    ...:

    ...: # Question - D : plotting in 4-sections in the year

    ...:

    ...: plt.title('Annual temperature [ 4-sections in the year ] ( 1901 to 2011 ):')

    ...: plt.xlabel('year -->')

    ...: plt.ylabel('temp -->')

    ...:

    ...: plt.plot(x,y2,

    ...: marker='+',

    ...: markersize=10,

    ...: linestyle='dashed',

    ...: label="[1] JAN-FEB")

    ...:

    ...: plt.plot(x,y3,

    ...: marker="*",

    ...: markersize=10,

    ...: linestyle='dashed',

    ...: label="[2] MAR-MAY")

    ...:

    ...: plt.plot(x,y4,

    ...: marker="X",

    ...: markersize=10,

    ...: linestyle='dashed',

    ...: label="[3] JUN-SEP")

    ...:

    ...: plt.plot(x,y5,

    ...: marker="o",

    ...: markersize=10,

    ...: linestyle='dashed',

    ...: label="[4] OCT-DEC")

    ...:

    ...: plt.legend()

    ...: plt.show()


------- output data :-----------


Temperature Data Analysis (1901 to 2011):


-----------------------------------


Dimension of the data frame = (111, 6)

--------------------------------------------


Column names as follows :


------------------------


0 --> YEAR

1 --> ANNUAL

2 --> JAN-FEB

3 --> MAR-MAY

4 --> JUN-SEP

5 --> OCT-DEC


-----------------------------



In [11]: