India's Rainfall analysis

Data visualisations made by Janhavi Pimplikar

A student at Pimpri Chinchwad College of Engineering

In [83]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
In [84]:
import seaborn as sns
import plotly as py
import cufflinks as cf
In [85]:
import plotly.express as px
import plotly.graph_objects as go
import plotly.figure_factory as ff
from plotly.subplots import make_subplots
In [86]:
py.offline.init_notebook_mode(connected=True)
In [87]:
cf.go_offline()
from plotly.offline import iplot

Accessing the number of districts in each state/union territories

In [88]:
rainfall=pd.read_csv('IndiaRainfall.csv')
In [89]:
rainfall
Out[89]:
STATE_UT_NAME DISTRICT JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC ANNUAL Jan-Feb Mar-May Jun-Sep Oct-Dec
0 ANDAMAN And NICOBAR ISLANDS NICOBAR 107.3 57.9 65.2 117.0 358.5 295.5 285.0 271.9 354.8 326.0 315.2 250.9 2805.2 165.2 540.7 1207.2 892.1
1 ANDAMAN And NICOBAR ISLANDS SOUTH ANDAMAN 43.7 26.0 18.6 90.5 374.4 457.2 421.3 423.1 455.6 301.2 275.8 128.3 3015.7 69.7 483.5 1757.2 705.3
2 ANDAMAN And NICOBAR ISLANDS N & M ANDAMAN 32.7 15.9 8.6 53.4 343.6 503.3 465.4 460.9 454.8 276.1 198.6 100.0 2913.3 48.6 405.6 1884.4 574.7
3 ARUNACHAL PRADESH LOHIT 42.2 80.8 176.4 358.5 306.4 447.0 660.1 427.8 313.6 167.1 34.1 29.8 3043.8 123.0 841.3 1848.5 231.0
4 ARUNACHAL PRADESH EAST SIANG 33.3 79.5 105.9 216.5 323.0 738.3 990.9 711.2 568.0 206.9 29.5 31.7 4034.7 112.8 645.4 3008.4 268.1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
636 KERALA IDUKKI 13.4 22.1 43.6 150.4 232.6 651.6 788.9 527.3 308.4 343.2 172.9 48.1 3302.5 35.5 426.6 2276.2 564.2
637 KERALA KASARGOD 2.3 1.0 8.4 46.9 217.6 999.6 1108.5 636.3 263.1 234.9 84.6 18.4 3621.6 3.3 272.9 3007.5 337.9
638 KERALA PATHANAMTHITTA 19.8 45.2 73.9 184.9 294.7 556.9 539.9 352.7 266.2 359.4 213.5 51.3 2958.4 65.0 553.5 1715.7 624.2
639 KERALA WAYANAD 4.8 8.3 17.5 83.3 174.6 698.1 1110.4 592.9 230.7 213.1 93.6 25.8 3253.1 13.1 275.4 2632.1 332.5
640 LAKSHADWEEP LAKSHADWEEP 20.8 14.7 11.8 48.9 171.7 330.2 287.7 217.5 163.1 157.1 117.7 58.8 1600.0 35.5 232.4 998.5 333.6

641 rows × 19 columns

In [90]:
states=rainfall[['STATE_UT_NAME','DISTRICT']]
In [91]:
statedata=rainfall['STATE_UT_NAME'].value_counts()
In [92]:
#above plot using plotly module
statedata.iplot(kind='bar',color='blue',legend=True,xTitle='Number of districts',yTitle='States and Union Territories',title='Number of districts in each state and union territory of India',orientation='v',bargap=0.7,theme='solar')

Analysis of rainfall received by each state/union territory (annual average and quarterly averages) as a whole

In [93]:
annual=rainfall[['STATE_UT_NAME','ANNUAL','Jan-Feb','Mar-May','Jun-Sep','Oct-Dec']]
In [94]:
annual
Out[94]:
STATE_UT_NAME ANNUAL Jan-Feb Mar-May Jun-Sep Oct-Dec
0 ANDAMAN And NICOBAR ISLANDS 2805.2 165.2 540.7 1207.2 892.1
1 ANDAMAN And NICOBAR ISLANDS 3015.7 69.7 483.5 1757.2 705.3
2 ANDAMAN And NICOBAR ISLANDS 2913.3 48.6 405.6 1884.4 574.7
3 ARUNACHAL PRADESH 3043.8 123.0 841.3 1848.5 231.0
4 ARUNACHAL PRADESH 4034.7 112.8 645.4 3008.4 268.1
... ... ... ... ... ... ...
636 KERALA 3302.5 35.5 426.6 2276.2 564.2
637 KERALA 3621.6 3.3 272.9 3007.5 337.9
638 KERALA 2958.4 65.0 553.5 1715.7 624.2
639 KERALA 3253.1 13.1 275.4 2632.1 332.5
640 LAKSHADWEEP 1600.0 35.5 232.4 998.5 333.6

641 rows × 6 columns

In [95]:
annual=annual.groupby('STATE_UT_NAME')[['ANNUAL','Jan-Feb','Mar-May','Jun-Sep','Oct-Dec']].mean() #The .mean() function will give us the average rainfall received by the state
In [96]:
annual.reset_index(inplace=True)
In [97]:
annual.iplot(x='STATE_UT_NAME',y='ANNUAL',mode='markers',bargroupgap=0.2,orientation='v',legend=True,xTitle='State/Union territory',yTitle='Rainfall (in mm)',title='Average annual rainfall in each state/union territory',color='red',theme='solar')
In [98]:
annual.iplot(x='STATE_UT_NAME',y='Jan-Feb',kind='bar',bargroupgap=0.2,orientation='v',legend=True,xTitle='State/Union territory',yTitle='Rainfall (in mm)',title='Average rainfall in each state/union territory (Jan-Feb)',color='pink',theme='solar')
In [99]:
annual.iplot(x='STATE_UT_NAME',y='Mar-May',kind='bar',bargroupgap=0.2,orientation='v',legend=True,xTitle='State/Union territory',yTitle='Rainfall (in mm)',title='Average rainfall in each state/union territory (Mar-May)',color='lightgreen',theme='solar')
In [100]:
annual.iplot(x='STATE_UT_NAME',y='Jun-Sep',kind='bar',bargroupgap=0.2,orientation='v',legend=True,xTitle='State/Union territory',yTitle='Rainfall (in mm)',title='Average rainfall in each state/union territory (Jun-Sep)',color='orange',theme='solar')
In [101]:
annual.iplot(x='STATE_UT_NAME',y='Oct-Dec',kind='bar',bargroupgap=0.2,orientation='v',legend=True,xTitle='State/Union territory',yTitle='Rainfall (in mm)',title='Average rainfall in each state/union territory (Oct-Dec)',color='purple',theme='solar')
In [ ]:
 

Top 10 states/union territories contributing towards the heaviest rainfall (annually and quarterly)

In [102]:
top10=annual.sort_values('ANNUAL',ascending=False).head(10)
In [103]:
top10
Out[103]:
STATE_UT_NAME ANNUAL Jan-Feb Mar-May Jun-Sep Oct-Dec
22 MEGHALAYA 3682.842857 36.585714 716.028571 2654.042857 276.185714
10 GOA 3278.500000 0.600000 96.100000 2980.900000 200.900000
17 KERALA 2937.392857 25.742857 384.821429 2046.142857 480.685714
2 ARUNACHAL PRADESH 2927.375000 146.981250 740.443750 1784.037500 255.912500
0 ANDAMAN And NICOBAR ISLANDS 2911.400000 94.500000 476.600000 1616.266667 724.033333
29 SIKKIM 2838.350000 124.850000 661.050000 1790.750000 261.700000
23 MIZORAM 2616.322222 41.511111 570.177778 1694.888889 309.744444
21 MANIPUR 2496.633333 77.722222 446.555556 1715.344444 257.011111
31 TRIPURA 2479.125000 44.875000 705.950000 1497.225000 231.075000
3 ASSAM 2454.359259 47.448148 592.900000 1641.200000 172.811111
In [104]:
fig,ax=plt.subplots(figsize=(8,8))
lab=top10['STATE_UT_NAME']
top10.plot.pie(y='ANNUAL',legend=False,shadow=True,ax=ax,autopct="%1.2f%%",colors=sns.color_palette('Accent'),fontsize=15,labels=lab)
plt.title('Percentage share of top 10 states/union territories receiving the most rainfall',size=15)
fig.show()
C:\Users\apimplikar\Desktop\Anaconda\lib\site-packages\ipykernel_launcher.py:5: UserWarning:

Matplotlib is currently using module://ipykernel.pylab.backend_inline, which is a non-GUI backend, so cannot show the figure.

In [105]:
top10_first=annual.sort_values('Jan-Feb',ascending=False).head(10)
top10_second=annual.sort_values('Mar-May',ascending=False).head(10)
In [106]:
top10_first
Out[106]:
STATE_UT_NAME ANNUAL Jan-Feb Mar-May Jun-Sep Oct-Dec
14 JAMMU AND KASHMIR 1016.618182 169.622727 267.390909 471.868182 107.736364
13 HIMACHAL 1371.591667 162.375000 189.675000 925.100000 94.441667
2 ARUNACHAL PRADESH 2927.375000 146.981250 740.443750 1784.037500 255.912500
29 SIKKIM 2838.350000 124.850000 661.050000 1790.750000 261.700000
33 UTTARANCHAL 1558.038462 99.484615 139.876923 1229.769231 88.907692
0 ANDAMAN And NICOBAR ISLANDS 2911.400000 94.500000 476.600000 1616.266667 724.033333
5 CHANDIGARH 1070.600000 83.200000 78.100000 844.200000 65.100000
21 MANIPUR 2496.633333 77.722222 446.555556 1715.344444 257.011111
26 PONDICHERRY 1378.475000 52.175000 69.825000 362.025000 894.450000
27 PUNJAB 648.545000 50.445000 54.225000 502.185000 41.690000
In [107]:
top10_second
Out[107]:
STATE_UT_NAME ANNUAL Jan-Feb Mar-May Jun-Sep Oct-Dec
2 ARUNACHAL PRADESH 2927.375000 146.981250 740.443750 1784.037500 255.912500
22 MEGHALAYA 3682.842857 36.585714 716.028571 2654.042857 276.185714
31 TRIPURA 2479.125000 44.875000 705.950000 1497.225000 231.075000
29 SIKKIM 2838.350000 124.850000 661.050000 1790.750000 261.700000
3 ASSAM 2454.359259 47.448148 592.900000 1641.200000 172.811111
23 MIZORAM 2616.322222 41.511111 570.177778 1694.888889 309.744444
0 ANDAMAN And NICOBAR ISLANDS 2911.400000 94.500000 476.600000 1616.266667 724.033333
21 MANIPUR 2496.633333 77.722222 446.555556 1715.344444 257.011111
24 NAGALAND 1940.700000 46.154545 410.627273 1313.854545 170.063636
17 KERALA 2937.392857 25.742857 384.821429 2046.142857 480.685714
In [108]:
fig,(ax1,ax2)=plt.subplots(nrows=1,ncols=2,figsize=(16,16))
fig.subplots_adjust(hspace=0.9)
labels1=top10_first['STATE_UT_NAME']
labels2=top10_second['STATE_UT_NAME']
patches,texts,autotexts=ax1.pie(top10_first['Jan-Feb'],shadow=True,labels=labels1,autopct='%1.2f%%')
plt.setp(autotexts,size=12)
ax1.set_title('% share (Jan-Feb)',size=15)
##############################################
patches,texts,autotexts=ax2.pie(top10_second['Mar-May'],shadow=True,labels=labels2,autopct='%1.2f%%')
plt.setp(autotexts,size=12)
ax2.set_title('% share (Mar-May)',size=15)
fig.show()
C:\Users\apimplikar\Desktop\Anaconda\lib\site-packages\ipykernel_launcher.py:12: UserWarning:

Matplotlib is currently using module://ipykernel.pylab.backend_inline, which is a non-GUI backend, so cannot show the figure.

In [109]:
top10_third=annual.sort_values('Jun-Sep',ascending=False).head(10)
top10_fourth=annual.sort_values('Oct-Dec',ascending=False).head(10)
In [110]:
top10_third
Out[110]:
STATE_UT_NAME ANNUAL Jan-Feb Mar-May Jun-Sep Oct-Dec
10 GOA 3278.500000 0.600000 96.100000 2980.900000 200.900000
22 MEGHALAYA 3682.842857 36.585714 716.028571 2654.042857 276.185714
7 DADAR NAGAR HAVELI 2374.100000 0.700000 7.400000 2316.900000 49.100000
17 KERALA 2937.392857 25.742857 384.821429 2046.142857 480.685714
29 SIKKIM 2838.350000 124.850000 661.050000 1790.750000 261.700000
2 ARUNACHAL PRADESH 2927.375000 146.981250 740.443750 1784.037500 255.912500
21 MANIPUR 2496.633333 77.722222 446.555556 1715.344444 257.011111
23 MIZORAM 2616.322222 41.511111 570.177778 1694.888889 309.744444
3 ASSAM 2454.359259 47.448148 592.900000 1641.200000 172.811111
0 ANDAMAN And NICOBAR ISLANDS 2911.400000 94.500000 476.600000 1616.266667 724.033333
In [111]:
top10_fourth
Out[111]:
STATE_UT_NAME ANNUAL Jan-Feb Mar-May Jun-Sep Oct-Dec
26 PONDICHERRY 1378.475000 52.175000 69.825000 362.025000 894.450000
0 ANDAMAN And NICOBAR ISLANDS 2911.400000 94.500000 476.600000 1616.266667 724.033333
17 KERALA 2937.392857 25.742857 384.821429 2046.142857 480.685714
30 TAMIL NADU 960.006250 32.928125 128.196875 330.840625 468.040625
18 LAKSHADWEEP 1600.000000 35.500000 232.400000 998.500000 333.600000
23 MIZORAM 2616.322222 41.511111 570.177778 1694.888889 309.744444
22 MEGHALAYA 3682.842857 36.585714 716.028571 2654.042857 276.185714
29 SIKKIM 2838.350000 124.850000 661.050000 1790.750000 261.700000
21 MANIPUR 2496.633333 77.722222 446.555556 1715.344444 257.011111
2 ARUNACHAL PRADESH 2927.375000 146.981250 740.443750 1784.037500 255.912500
In [112]:
fig,(ax1,ax2)=plt.subplots(nrows=1,ncols=2,figsize=(16,16))
fig.subplots_adjust(hspace=0.9)
labels1=top10_third['STATE_UT_NAME']
labels2=top10_fourth['STATE_UT_NAME']
patches,texts,autotexts=ax1.pie(top10_third['Jun-Sep'],shadow=True,labels=labels1,autopct='%1.2f%%')
plt.setp(autotexts,size=12)
ax1.set_title('% share (Jun-Sep)',size=15)
##############################################
patches,texts,autotexts=ax2.pie(top10_fourth['Oct-Dec'],shadow=True,labels=labels2,autopct='%1.2f%%')
plt.setp(autotexts,size=12)
ax2.set_title('% share (Oct-Dec)',size=15)
fig.show()
C:\Users\apimplikar\Desktop\Anaconda\lib\site-packages\ipykernel_launcher.py:12: UserWarning:

Matplotlib is currently using module://ipykernel.pylab.backend_inline, which is a non-GUI backend, so cannot show the figure.

In [ ]:
 

Analysing monthly rainfall for 6 states/union territories as a whole

In [113]:
monthly_rain=rainfall.groupby('STATE_UT_NAME')[['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC']].mean()
In [114]:
monthly_rain
Out[114]:
JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
STATE_UT_NAME
ANDAMAN And NICOBAR ISLANDS 61.233333 33.266667 30.800000 86.966667 358.833333 418.666667 390.566667 385.300000 421.733333 301.100000 263.200000 159.733333
ANDHRA PRADESH 6.321739 7.352174 10.095652 19.873913 48.765217 114.369565 185.365217 179.426087 160.373913 138.600000 58.965217 15.565217
ARUNACHAL PRADESH 53.687500 93.293750 165.018750 275.162500 300.262500 491.381250 547.581250 378.600000 366.475000 176.768750 43.187500 35.956250
ASSAM 15.733333 31.714815 77.762963 181.266667 333.870370 465.185185 494.844444 377.370370 303.800000 136.448148 24.922222 11.440741
BIHAR 13.134211 9.278947 9.873684 16.865789 51.673684 168.781579 340.836842 289.481579 223.378947 64.747368 6.715789 5.786842
CHANDIGARH 44.300000 38.900000 33.200000 14.800000 30.100000 120.000000 282.400000 287.500000 154.300000 31.800000 9.900000 23.400000
CHATISGARH 10.377778 10.472222 12.977778 13.116667 17.483333 180.583333 375.405556 375.338889 214.444444 61.844444 8.494444 5.811111
DADAR NAGAR HAVELI 0.400000 0.300000 0.000000 0.000000 7.400000 385.100000 884.500000 655.900000 391.400000 38.600000 10.500000 0.000000
DAMAN AND DUI 0.550000 0.500000 0.200000 0.100000 4.150000 276.500000 583.100000 394.600000 227.600000 35.550000 12.400000 0.450000
DELHI 16.400000 16.300000 15.300000 8.900000 19.300000 59.800000 220.700000 245.500000 110.200000 20.500000 5.600000 8.600000
GOA 0.550000 0.050000 0.550000 7.800000 87.750000 908.100000 1108.100000 683.800000 280.900000 155.700000 35.000000 10.200000
GUJARAT 0.784615 0.392308 1.142308 0.507692 4.803846 139.246154 333.838462 257.630769 148.473077 25.103846 10.826923 1.592308
HARYANA 19.485714 16.457143 13.738095 7.619048 14.642857 51.009524 180.361905 190.909524 88.723810 18.428571 5.266667 7.914286
HIMACHAL 81.925000 80.450000 87.633333 47.683333 54.358333 108.683333 343.825000 322.325000 150.266667 39.308333 16.908333 38.225000
JAMMU AND KASHMIR 77.977273 91.645455 119.986364 82.268182 65.136364 53.604545 172.090909 167.918182 78.254545 34.181818 27.159091 46.395455
JHARKHAND 15.837500 16.320833 16.516667 18.662500 45.875000 198.775000 333.854167 310.316667 250.958333 79.404167 10.212500 6.704167
KARNATAKA 2.026667 2.696667 7.163333 36.773333 88.166667 204.880000 280.700000 209.256667 164.076667 143.356667 44.350000 11.170000
KERALA 9.542857 16.200000 31.071429 109.021429 244.728571 658.707143 724.328571 417.950000 245.157143 290.907143 151.535714 38.242857
LAKSHADWEEP 20.800000 14.700000 11.800000 48.900000 171.700000 330.200000 287.700000 217.500000 163.100000 157.100000 117.700000 58.800000
MADHYA PRADESH 12.892000 9.158000 7.486000 3.270000 7.006000 114.686000 311.088000 331.048000 181.574000 35.270000 10.042000 8.790000
MAHARASHTRA 4.791429 3.474286 5.997143 6.974286 19.925714 240.980000 388.894286 314.585714 191.311429 75.648571 18.588571 7.417143
MANIPUR 22.600000 55.122222 82.411111 150.766667 213.377778 487.088889 498.055556 451.800000 278.400000 189.222222 56.000000 11.788889
MEGHALAYA 14.900000 21.685714 74.757143 211.228571 430.042857 757.228571 857.742857 584.371429 454.700000 225.571429 39.571429 11.042857
MIZORAM 11.566667 29.944444 96.255556 152.600000 321.322222 429.833333 452.311111 440.588889 372.155556 229.822222 64.633333 15.288889
NAGALAND 18.481818 27.672727 63.018182 134.227273 213.381818 340.318182 395.036364 350.872727 227.627273 121.154545 38.554545 10.354545
ORISSA 10.810000 22.370000 27.453333 36.653333 70.723333 212.516667 332.316667 363.346667 238.336667 116.056667 30.400000 5.136667
PONDICHERRY 26.750000 25.425000 16.725000 12.275000 40.825000 47.675000 78.025000 116.425000 119.900000 271.950000 395.150000 227.350000
PUNJAB 25.965000 24.480000 25.900000 12.160000 16.165000 46.325000 190.610000 172.415000 92.835000 21.700000 6.085000 13.905000
RAJASTHAN 5.348485 4.721212 3.815152 3.303030 10.627273 54.096970 195.278788 194.554545 86.145455 14.430303 6.254545 3.021212
SIKKIM 47.550000 77.300000 130.600000 206.900000 323.550000 483.800000 499.200000 434.600000 373.150000 209.850000 30.950000 20.900000
TAMIL NADU 18.906250 14.021875 18.068750 42.596875 67.531250 50.321875 72.606250 91.571875 116.340625 186.928125 184.625000 96.487500
TRIPURA 11.225000 33.650000 93.625000 220.750000 391.575000 465.425000 414.975000 356.475000 260.350000 176.650000 43.300000 11.125000
UTTAR PRADESH 17.183099 13.157746 10.107042 5.318310 15.561972 90.770423 280.067606 291.232394 175.074648 45.525352 4.576056 6.870423
UTTARANCHAL 49.892308 49.592308 51.669231 29.815385 58.392308 165.715385 432.792308 426.784615 204.476923 58.838462 9.238462 20.830769
WEST BENGAL 15.031579 19.084211 27.973684 56.647368 139.489474 308.531579 412.989474 361.573684 317.978947 124.373684 19.389474 7.363158
In [ ]:
 
In [115]:
mh=monthly_rain.loc['MAHARASHTRA']
In [116]:
mh.iplot(kind='line',mode='markers',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend in Maharashtra',color='blue',fill=True,legend=True,theme='solar')
In [117]:
ors=monthly_rain.loc['ORISSA']
In [118]:
ors.iplot(kind='line',mode='markers',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend in Orissa',color='pink',fill=True,legend=True,theme='solar')
In [119]:
pun=monthly_rain.loc['PUNJAB']
In [120]:
pun.iplot(kind='line',mode='markers',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend in Punjab',color='orange',fill=True,legend=True,theme='solar')
In [121]:
tam=monthly_rain.loc['TAMIL NADU']
In [122]:
tam.iplot(kind='line',mode='markers',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend in Tamil Nadu',color='green',fill=True,legend=True,theme='solar')
In [123]:
meg=monthly_rain.loc['MEGHALAYA']
In [124]:
meg.iplot(kind='line',mode='markers',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend in Meghalaya',color='red',fill=True,legend=True,theme='solar')
In [125]:
pon=monthly_rain.loc['PONDICHERRY']
In [126]:
pon.iplot(kind='line',mode='markers',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend in Pondicherry',color='purple',fill=True,legend=True,theme='solar')

Variation in rainfall for each district of selected states/union territories

1. Maharashtra

In [127]:
mh_district=rainfall.loc[rainfall['STATE_UT_NAME']=="MAHARASHTRA"]
In [128]:
sub_mh=mh_district.groupby('DISTRICT')['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'].sum()
C:\Users\apimplikar\Desktop\Anaconda\lib\site-packages\ipykernel_launcher.py:1: FutureWarning:

Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.

In [129]:
sub_mh=sub_mh.transpose()
In [130]:
sub_mh.iplot(kind='line',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend over all districts in Maharashtra',theme='solar')
In [ ]:
 

2. Orissa

In [131]:
ors_district=rainfall.loc[rainfall['STATE_UT_NAME']=='ORISSA']
In [132]:
sub_ors=ors_district.groupby('DISTRICT')['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'].sum()
C:\Users\apimplikar\Desktop\Anaconda\lib\site-packages\ipykernel_launcher.py:1: FutureWarning:

Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.

In [133]:
sub_ors=sub_ors.transpose()
In [134]:
sub_ors.iplot(kind='line',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend over all districts in Orissa ',theme='solar')
In [ ]:
 

3. Punjab

In [135]:
pun_district=rainfall.loc[rainfall['STATE_UT_NAME']=='PUNJAB']
In [136]:
sub_pun=pun_district.groupby('DISTRICT')['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'].sum()
C:\Users\apimplikar\Desktop\Anaconda\lib\site-packages\ipykernel_launcher.py:1: FutureWarning:

Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.

In [137]:
sub_pun=sub_pun.transpose()
In [138]:
sub_pun.iplot(kind='line',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend over all districts in Punjab',theme='solar')
In [ ]:
 

4. Tamil Nadu

In [139]:
tn_district=rainfall.loc[rainfall['STATE_UT_NAME']=='TAMIL NADU']
In [140]:
sub_tn=tn_district.groupby('DISTRICT')['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'].sum()
C:\Users\apimplikar\Desktop\Anaconda\lib\site-packages\ipykernel_launcher.py:1: FutureWarning:

Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.

In [141]:
sub_tn=sub_tn.transpose()
In [142]:
sub_tn.iplot(kind='line',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall over all districts in Tamil Nadu',theme='solar')
In [ ]:
 

5. Meghalaya

In [143]:
meg_district=rainfall.loc[rainfall['STATE_UT_NAME']=='MEGHALAYA']
In [144]:
sub_meg=meg_district.groupby('DISTRICT')['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'].sum()
C:\Users\apimplikar\Desktop\Anaconda\lib\site-packages\ipykernel_launcher.py:1: FutureWarning:

Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.

In [145]:
sub_meg=sub_meg.transpose()
In [146]:
sub_meg.iplot(kind='line',xTitle='Months',yTitle='Rainfall (in mm)', title='Rainfall over all districts in Meghalaya',theme='solar')
In [ ]:
 

6. Pondicherry

In [147]:
pond_district=rainfall.loc[rainfall['STATE_UT_NAME']=='PONDICHERRY']
In [148]:
sub_pd=pond_district.groupby('DISTRICT')['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'].sum()
C:\Users\apimplikar\Desktop\Anaconda\lib\site-packages\ipykernel_launcher.py:1: FutureWarning:

Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.

In [149]:
sub_pd=sub_pd.transpose()
In [150]:
sub_pd.iplot(kind='line',xTitle='Months',yTitle='Rainfall (in mm)',title='Rainfall trend over all districts in Pondicherry',theme='solar')
In [ ]:
 

Dataset: imported from https://www.kaggle.com/rajanand/rainfall-in-india?select=district+wise+rainfall+normal.csv

Attribution: (websites such as stackoverflow.com, medium.com etc.)