In [128]:
#Import Libraries
import numpy as np
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point, Polygon
import json
import requests
import math
import os
import time
import datetime
In [129]:
# Import folders
data_folder = os.path.abspath('data')
# Set Output Folder
output_folder = os.path.abspath("output")
if not os.path.exists(output_folder):
    os.makedirs(output_folder)
In [130]:
# Read Constituency Data
ac_gdf = None
ac_filepath = os.path.join(data_folder, "AC", "India_AC.shp")
ac_gdf = gpd.read_file(ac_filepath)
ac_gdf

# Read Constituency Data
ac_file = os.path.join(data_folder, "General_Later_Ashoka_alldata.csv")
acdf = pd.read_csv(ac_file)
acdf['state_name'] = acdf['state_name'].str.replace("_", " ")
#acdf = acdf[['state_name', 'constituency_no', 'constituency_name', 'year', 'month']]
acdf = acdf.drop_duplicates(subset=None, keep="first", inplace=False).reset_index(drop=True)
acdf.loc[acdf['newstate_code'] == 36, 'newstate_code'] = 28 #Telangana  Fix
acdf = acdf[['state_name', 'state_code', 'constituency_no', 'year', 'month']]
acdf['day'] = 1
acdf['dyear'] = 0
acdf.loc[(acdf['month'] > 9) | (acdf['year'] == 2008), 'dyear'] = 1
acdf['dyear'] = acdf['year'] + acdf['dyear']
acdf['datetime'] = pd.to_datetime(acdf[['year', 'month', 'day']])
acdf = acdf.drop_duplicates().reset_index(drop=True)
acdf = pd.merge(acdf, ac_gdf,  how='inner', left_on=['state_code', 'constituency_no'], right_on = ['ST_CODE','AC_NO'])#[['ST_CODE', 'ST_NAME','DT_CODE', 'DIST_NAME', 'AC_NO', 'AC_NAME', 'PC_NO', 'PC_NAME']]
acdf = acdf[acdf.columns[:-5]]
acdf
Out[130]:
state_name state_code constituency_no year month day dyear datetime OBJECTID ST_CODE ST_NAME DT_CODE DIST_NAME AC_NO AC_NAME PC_NO PC_NAME
0 Jammu & Kashmir 1 1 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 1 KARNAH 1 BARAMULLA
1 Jammu & Kashmir 1 1 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 1 KARNAH 1 BARAMULLA
2 Jammu & Kashmir 1 2 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 2 KUPWARA 1 BARAMULLA
3 Jammu & Kashmir 1 2 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 2 KUPWARA 1 BARAMULLA
4 Jammu & Kashmir 1 3 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 3 LOLAB 1 BARAMULLA
5 Jammu & Kashmir 1 3 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 3 LOLAB 1 BARAMULLA
6 Jammu & Kashmir 1 4 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 4 HANDWARA 1 BARAMULLA
7 Jammu & Kashmir 1 4 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 4 HANDWARA 1 BARAMULLA
8 Jammu & Kashmir 1 5 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 5 LANGATE 1 BARAMULLA
9 Jammu & Kashmir 1 5 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 1.0 KUPWARA 5 LANGATE 1 BARAMULLA
10 Jammu & Kashmir 1 6 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 6 URI 1 BARAMULLA
11 Jammu & Kashmir 1 6 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 6 URI 1 BARAMULLA
12 Jammu & Kashmir 1 7 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 7 RAFIABAD 1 BARAMULLA
13 Jammu & Kashmir 1 7 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 7 RAFIABAD 1 BARAMULLA
14 Jammu & Kashmir 1 8 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 8 SOPORE 1 BARAMULLA
15 Jammu & Kashmir 1 8 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 8 SOPORE 1 BARAMULLA
16 Jammu & Kashmir 1 9 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 9 GUREZ 1 BARAMULLA
17 Jammu & Kashmir 1 9 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 9 GUREZ 1 BARAMULLA
18 Jammu & Kashmir 1 10 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 10 BANDIPORA 1 BARAMULLA
19 Jammu & Kashmir 1 10 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 10 BANDIPORA 1 BARAMULLA
20 Jammu & Kashmir 1 11 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 11 SONAWARI 1 BARAMULLA
21 Jammu & Kashmir 1 11 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 11 SONAWARI 1 BARAMULLA
22 Jammu & Kashmir 1 12 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 12 SANGRAMA 1 BARAMULLA
23 Jammu & Kashmir 1 12 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 12 SANGRAMA 1 BARAMULLA
24 Jammu & Kashmir 1 13 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 13 BARAMULA 1 BARAMULLA
25 Jammu & Kashmir 1 13 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 13 BARAMULA 1 BARAMULLA
26 Jammu & Kashmir 1 14 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 14 GULMARG 1 BARAMULLA
27 Jammu & Kashmir 1 14 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 14 GULMARG 1 BARAMULLA
28 Jammu & Kashmir 1 15 2008 12 1 2009 2008-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 15 PATTAN 1 BARAMULLA
29 Jammu & Kashmir 1 15 2014 12 1 2015 2014-12-01 1 1 JAMMU & KASHMIR 2.0 BARAMULA 15 PATTAN 1 BARAMULLA
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
8328 Puducherry 34 16 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 16 Orleampeth 1 PONDICHERRY
8329 Puducherry 34 16 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 16 Orleampeth 1 PONDICHERRY
8330 Puducherry 34 17 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 17 Nellithope 1 PONDICHERRY
8331 Puducherry 34 17 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 17 Nellithope 1 PONDICHERRY
8332 Puducherry 34 18 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 18 Mudaliarpet 1 PONDICHERRY
8333 Puducherry 34 18 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 18 Mudaliarpet 1 PONDICHERRY
8334 Puducherry 34 19 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 19 Ariankuppam 1 PONDICHERRY
8335 Puducherry 34 19 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 19 Ariankuppam 1 PONDICHERRY
8336 Puducherry 34 20 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 20 Manavely 1 PONDICHERRY
8337 Puducherry 34 20 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 20 Manavely 1 PONDICHERRY
8338 Puducherry 34 21 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 21 Embalam (SC) 1 PONDICHERRY
8339 Puducherry 34 21 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 21 Embalam (SC) 1 PONDICHERRY
8340 Puducherry 34 22 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 22 Nettapakkam (SC) 1 PONDICHERRY
8341 Puducherry 34 22 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 22 Nettapakkam (SC) 1 PONDICHERRY
8342 Puducherry 34 23 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 23 Bahour 1 PONDICHERRY
8343 Puducherry 34 23 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 2.0 PONDICHERRY 23 Bahour 1 PONDICHERRY
8344 Puducherry 34 24 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 24 Nedungadu (SC) 1 PONDICHERRY
8345 Puducherry 34 24 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 24 Nedungadu (SC) 1 PONDICHERRY
8346 Puducherry 34 25 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 25 Thirunallar 1 PONDICHERRY
8347 Puducherry 34 25 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 25 Thirunallar 1 PONDICHERRY
8348 Puducherry 34 26 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 26 Karaikal North 1 PONDICHERRY
8349 Puducherry 34 26 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 26 Karaikal North 1 PONDICHERRY
8350 Puducherry 34 27 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 27 Karaikal South 1 PONDICHERRY
8351 Puducherry 34 27 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 27 Karaikal South 1 PONDICHERRY
8352 Puducherry 34 28 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 28 Neravy- T.R. Pattin 1 PONDICHERRY
8353 Puducherry 34 28 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 4.0 KARAIKAL 28 Neravy- T.R. Pattin 1 PONDICHERRY
8354 Puducherry 34 29 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 3.0 MAHE 29 Mahe 1 PONDICHERRY
8355 Puducherry 34 29 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 3.0 MAHE 29 Mahe 1 PONDICHERRY
8356 Puducherry 34 30 2011 5 1 2011 2011-05-01 1 34 PUDUCHERRY 1.0 YANAM 30 Yanam 1 PONDICHERRY
8357 Puducherry 34 30 2016 5 1 2016 2016-05-01 1 34 PUDUCHERRY 1.0 YANAM 30 Yanam 1 PONDICHERRY

8358 rows × 17 columns

In [131]:
# Read geocoded Scrapped Data
geocoded_folder = os.path.join(data_folder, "Scrapped", "geocoded")
geocoded_files = os.listdir(geocoded_folder)
geocoded_files = [os.path.join(geocoded_folder, x)  for x in geocoded_files if x.split('.')[-1] == 'csv']
df_list = []
for file in geocoded_files:
    df = pd.read_csv(file)
    statuscol = 'Status as on 1/4/' + file.split('-')[-2].split('_')[-1]    
    print(statuscol)
    df = df[['Financial Year', 'Habit Category', statuscol, 'Tot Pop', 'ac code', 'state code']]
    df.columns = ['Financial Year', 'Habit Category', 'Status', 'Tot Pop', 'ac code', 'state code']
    df_list.append(df)
# Merge All Data
water_df = pd.concat(df_list).reset_index(drop=True)
water_df = water_df[water_df['Status'].isin(['FC', 'PC', 'QA'])]
water_df['dyear'] = water_df['Financial Year'].str.split('-').str[0].fillna(0).astype(int)
water_df = water_df[water_df.columns[1:]]
water_df['Tot Pop'] = water_df['Tot Pop'].apply(pd.to_numeric, errors='ceorce').fillna(0).astype(int)
water_df = water_df.groupby(['Habit Category', 'Status', 'ac code', 'state code', 'dyear']).sum().reset_index()
water_df
Status as on 1/4/2009
C:\Users\sandyjones\AppData\Local\conda\conda\envs\geo\lib\site-packages\IPython\core\interactiveshell.py:2785: DtypeWarning: Columns (7,13,14) have mixed types. Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)
Status as on 1/4/2010
Status as on 1/4/2011
Status as on 1/4/2012
Status as on 1/4/2013
Status as on 1/4/2014
Status as on 1/4/2015
Status as on 1/4/2016
Status as on 1/4/2017
Out[131]:
Habit Category Status ac code state code dyear Tot Pop
0 No. Of Habitation With 100% Population Coverage FC 0 1 2009 2786
1 No. Of Habitation With 100% Population Coverage FC 0 1 2010 9314
2 No. Of Habitation With 100% Population Coverage FC 0 1 2011 11189
3 No. Of Habitation With 100% Population Coverage FC 0 1 2012 11867
4 No. Of Habitation With 100% Population Coverage FC 0 1 2013 16377
5 No. Of Habitation With 100% Population Coverage FC 0 1 2014 13948
6 No. Of Habitation With 100% Population Coverage FC 0 1 2015 14990
7 No. Of Habitation With 100% Population Coverage FC 0 1 2016 15650
8 No. Of Habitation With 100% Population Coverage FC 0 1 2017 16359
9 No. Of Habitation With 100% Population Coverage FC 0 11 2009 15970
10 No. Of Habitation With 100% Population Coverage FC 0 11 2010 17557
11 No. Of Habitation With 100% Population Coverage FC 0 11 2011 17202
12 No. Of Habitation With 100% Population Coverage FC 0 11 2012 18929
13 No. Of Habitation With 100% Population Coverage FC 0 11 2013 7715
14 No. Of Habitation With 100% Population Coverage FC 0 11 2014 6968
15 No. Of Habitation With 100% Population Coverage FC 0 11 2015 5829
16 No. Of Habitation With 100% Population Coverage FC 0 11 2016 5503
17 No. Of Habitation With 100% Population Coverage FC 0 11 2017 5503
18 No. Of Habitation With 100% Population Coverage FC 0 24 2013 2692
19 No. Of Habitation With 100% Population Coverage FC 0 24 2014 3862
20 No. Of Habitation With 100% Population Coverage FC 0 24 2015 5729
21 No. Of Habitation With 100% Population Coverage FC 0 24 2016 6579
22 No. Of Habitation With 100% Population Coverage FC 0 24 2017 6826
23 No. Of Habitation With 100% Population Coverage FC 0 27 2009 280
24 No. Of Habitation With 100% Population Coverage FC 0 27 2010 280
25 No. Of Habitation With 100% Population Coverage FC 1 1 2009 300
26 No. Of Habitation With 100% Population Coverage FC 1 1 2010 12268
27 No. Of Habitation With 100% Population Coverage FC 1 1 2011 12268
28 No. Of Habitation With 100% Population Coverage FC 1 1 2012 34122
29 No. Of Habitation With 100% Population Coverage FC 1 1 2013 23231
... ... ... ... ... ... ...
109564 No. Of Habitation With Population Coverage >= ... QA 378 9 2011 4532
109565 No. Of Habitation With Population Coverage >= ... QA 378 9 2012 6798
109566 No. Of Habitation With Population Coverage >= ... QA 382 9 2011 196
109567 No. Of Habitation With Population Coverage >= ... QA 382 9 2012 196
109568 No. Of Habitation With Population Coverage >= ... QA 382 9 2013 1194
109569 No. Of Habitation With Population Coverage >= ... QA 383 9 2011 2874
109570 No. Of Habitation With Population Coverage >= ... QA 383 9 2012 4311
109571 No. Of Habitation With Population Coverage >= ... QA 388 9 2013 705
109572 No. Of Habitation With Population Coverage >= ... QA 398 9 2017 410
109573 No. Of Habitation With Population Coverage >= ... QA 400 9 2011 6969
109574 No. Of Habitation With Population Coverage >= ... QA 400 9 2013 11828
109575 No. Of Habitation With Population Coverage >= ... QA 400 9 2014 21238
109576 No. Of Habitation With Population Coverage >= ... QA 400 9 2015 21238
109577 No. Of Habitation With Population Coverage >= ... QA 400 9 2016 21238
109578 No. Of Habitation With Population Coverage >= ... QA 400 9 2017 21238
109579 No. Of Habitation With Population Coverage >= ... QA 401 9 2011 33126
109580 No. Of Habitation With Population Coverage >= ... QA 401 9 2012 402
109581 No. Of Habitation With Population Coverage >= ... QA 401 9 2013 65150
109582 No. Of Habitation With Population Coverage >= ... QA 401 9 2014 6014
109583 No. Of Habitation With Population Coverage >= ... QA 401 9 2015 6014
109584 No. Of Habitation With Population Coverage >= ... QA 401 9 2016 6014
109585 No. Of Habitation With Population Coverage >= ... QA 401 9 2017 6014
109586 No. Of Habitation With Population Coverage >= ... QA 402 9 2011 11277
109587 No. Of Habitation With Population Coverage >= ... QA 402 9 2013 39558
109588 No. Of Habitation With Population Coverage >= ... QA 402 9 2014 17577
109589 No. Of Habitation With Population Coverage >= ... QA 402 9 2015 13027
109590 No. Of Habitation With Population Coverage >= ... QA 402 9 2016 15302
109591 No. Of Habitation With Population Coverage >= ... QA 402 9 2017 15302
109592 No. Of Habitation With Population Coverage >= ... QA 403 9 2011 32826
109593 No. Of Habitation With Population Coverage >= ... QA 403 9 2013 112275

109594 rows × 6 columns

In [132]:
variables = [
    'start_100%_cvg',
    'start_0-25%_cvg',
    'start_25-50%_cvg',
    'start_50-75%_cvg',
    'start_75-100%_cvg',
    'start_fc',
    'start_pc',
    'start_qa',
    'start_tot_pop',
    'end_100%_cvg',
    'end_0-25%_cvg',
    'end_25-50%_cvg',
    'end_50-75%_cvg',
    'end_75-100%_cvg',
    'end_fc',
    'end_pc',
    'end_qa',
    'end_tot_pop'
]
#Get all variables
def get_ac_variables(row):
    #print(pd.DataFrame(row).T)
    next_elect = acdf[(acdf['state_code'] == row['state_code']) & (acdf['constituency_no'] == row['constituency_no']) & (acdf['datetime'] > row['datetime'])][0:1]
    if len(next_elect) < 1:
        next_elect = pd.DataFrame(row).T
        next_elect['dyear'] = next_elect['dyear'] + 5
        next_elect['datetime'] = next_elect['datetime'] + pd.DateOffset(years=5)
    #print(next_elect)
    #Starting of Election Term
    df1 = water_df[(water_df['state code'] == row['state_code']) & (water_df['ac code'] == row['constituency_no']) & (water_df['dyear'] >= row['dyear']) & (water_df['dyear'] < next_elect['dyear'].values[0])][0:1]
    #print(df1)
    var1 = df1[df1['Habit Category'] == 'No. Of Habitation With 100% Population Coverage']['Tot Pop'].sum()
    var2 = df1[df1['Habit Category'] == 'No. Of Habitation With Population Coverage > 0 and < 25%']['Tot Pop'].sum()
    var3 = df1[df1['Habit Category'] == 'No. Of Habitation With Population Coverage >= 25 and < 50%']['Tot Pop'].sum()
    var4 = df1[df1['Habit Category'] == 'No. Of Habitation With Population Coverage >= 50 and < 75%']['Tot Pop'].sum()
    var5 = df1[df1['Habit Category'] == 'No. Of Habitation With Population Coverage >= 75 and < 100%']['Tot Pop'].sum()
    var6 = df1[df1['Status'] == 'FC']['Tot Pop'].sum()
    var7 = df1[df1['Status'] == 'PC']['Tot Pop'].sum()
    var8 = df1[df1['Status'] == 'QA']['Tot Pop'].sum()
    var9 = df1['Tot Pop'].sum()
    #End of Election Term
    df2 = water_df[(water_df['state code'] == row['state_code']) & (water_df['ac code'] == row['constituency_no']) & (water_df['dyear'] > row['dyear']) & (water_df['dyear'] <= next_elect['dyear'].values[0])][-1:]
    #print(df2)
    var21 = df2[df2['Habit Category'] == 'No. Of Habitation With 100% Population Coverage']['Tot Pop'].sum()
    var22 = df2[df2['Habit Category'] == 'No. Of Habitation With Population Coverage > 0 and < 25%']['Tot Pop'].sum()
    var23 = df2[df2['Habit Category'] == 'No. Of Habitation With Population Coverage >= 25 and < 50%']['Tot Pop'].sum()
    var24 = df2[df2['Habit Category'] == 'No. Of Habitation With Population Coverage >= 50 and < 75%']['Tot Pop'].sum()
    var25 = df2[df2['Habit Category'] == 'No. Of Habitation With Population Coverage >= 75 and < 100%']['Tot Pop'].sum()
    var26 = df2[df2['Status'] == 'FC']['Tot Pop'].sum()
    var27 = df2[df2['Status'] == 'PC']['Tot Pop'].sum()
    var28 = df2[df2['Status'] == 'QA']['Tot Pop'].sum()
    var29 = df2['Tot Pop'].sum()
    #Return Now
    return var1, var2, var3, var4, var5, var6, var7, var8, var9, var21, var22, var23, var24, var25, var26, var27, var28, var29
#Apply This Function
acdf[variables] = acdf.apply(get_ac_variables, axis=1, result_type='expand')
acdf
Out[132]:
state_name state_code constituency_no year month day dyear datetime OBJECTID ST_CODE ... start_tot_pop end_100%_cvg end_0-25%_cvg end_25-50%_cvg end_50-75%_cvg end_75-100%_cvg end_fc end_pc end_qa end_tot_pop
0 Jammu & Kashmir 1 1 2008 12 1 2009 2008-12-01 1 1 ... 300 0 0 0 0 1530 0 1530 0 1530
1 Jammu & Kashmir 1 1 2014 12 1 2015 2014-12-01 1 1 ... 22546 0 0 0 12792 0 0 12792 0 12792
2 Jammu & Kashmir 1 2 2008 12 1 2009 2008-12-01 1 1 ... 6494 0 0 0 0 2173 0 2173 0 2173
3 Jammu & Kashmir 1 2 2014 12 1 2015 2014-12-01 1 1 ... 42341 0 0 0 2214 0 0 0 2214 2214
4 Jammu & Kashmir 1 3 2008 12 1 2009 2008-12-01 1 1 ... 3000 0 0 0 0 1300 0 1300 0 1300
5 Jammu & Kashmir 1 3 2014 12 1 2015 2014-12-01 1 1 ... 6109 0 0 0 40446 0 0 40446 0 40446
6 Jammu & Kashmir 1 4 2008 12 1 2009 2008-12-01 1 1 ... 5383 0 0 0 0 2970 0 0 2970 2970
7 Jammu & Kashmir 1 4 2014 12 1 2015 2014-12-01 1 1 ... 255381 0 0 0 0 10177 0 0 10177 10177
8 Jammu & Kashmir 1 5 2008 12 1 2009 2008-12-01 1 1 ... 2684 0 0 0 0 3178 0 3178 0 3178
9 Jammu & Kashmir 1 5 2014 12 1 2015 2014-12-01 1 1 ... 53196 0 0 0 0 1247 0 0 1247 1247
10 Jammu & Kashmir 1 6 2008 12 1 2009 2008-12-01 1 1 ... 8732 0 0 0 0 430 0 430 0 430
11 Jammu & Kashmir 1 6 2014 12 1 2015 2014-12-01 1 1 ... 19970 0 0 0 0 430 0 430 0 430
12 Jammu & Kashmir 1 7 2008 12 1 2009 2008-12-01 1 1 ... 13020 0 0 0 0 4068 0 4068 0 4068
13 Jammu & Kashmir 1 7 2014 12 1 2015 2014-12-01 1 1 ... 65612 0 0 0 43617 0 0 43617 0 43617
14 Jammu & Kashmir 1 8 2008 12 1 2009 2008-12-01 1 1 ... 38643 0 0 0 0 2062 0 2062 0 2062
15 Jammu & Kashmir 1 8 2014 12 1 2015 2014-12-01 1 1 ... 34484 0 0 0 55744 0 0 55744 0 55744
16 Jammu & Kashmir 1 9 2008 12 1 2009 2008-12-01 1 1 ... 3547 0 0 0 0 823 0 823 0 823
17 Jammu & Kashmir 1 9 2014 12 1 2015 2014-12-01 1 1 ... 13471 0 0 0 8981 0 0 8981 0 8981
18 Jammu & Kashmir 1 10 2008 12 1 2009 2008-12-01 1 1 ... 67533 0 0 0 0 1000 0 1000 0 1000
19 Jammu & Kashmir 1 10 2014 12 1 2015 2014-12-01 1 1 ... 106060 0 0 0 126683 0 0 126683 0 126683
20 Jammu & Kashmir 1 11 2008 12 1 2009 2008-12-01 1 1 ... 30203 0 0 0 0 7607 0 7607 0 7607
21 Jammu & Kashmir 1 11 2014 12 1 2015 2014-12-01 1 1 ... 51250 0 0 0 24561 0 0 24561 0 24561
22 Jammu & Kashmir 1 12 2008 12 1 2009 2008-12-01 1 1 ... 87510 0 0 0 0 640 0 640 0 640
23 Jammu & Kashmir 1 12 2014 12 1 2015 2014-12-01 1 1 ... 54055 0 0 0 24855 0 0 24855 0 24855
24 Jammu & Kashmir 1 13 2008 12 1 2009 2008-12-01 1 1 ... 3590 0 0 0 0 7680 0 0 7680 7680
25 Jammu & Kashmir 1 13 2014 12 1 2015 2014-12-01 1 1 ... 206465 0 0 0 0 8920 0 0 8920 8920
26 Jammu & Kashmir 1 14 2008 12 1 2009 2008-12-01 1 1 ... 40328 0 0 0 0 5265 0 5265 0 5265
27 Jammu & Kashmir 1 14 2014 12 1 2015 2014-12-01 1 1 ... 48170 0 0 0 36133 0 0 36133 0 36133
28 Jammu & Kashmir 1 15 2008 12 1 2009 2008-12-01 1 1 ... 24578 0 0 0 0 4590 0 0 4590 4590
29 Jammu & Kashmir 1 15 2014 12 1 2015 2014-12-01 1 1 ... 38616 0 0 0 0 145 0 145 0 145
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
8328 Puducherry 34 16 2011 5 1 2011 2011-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8329 Puducherry 34 16 2016 5 1 2016 2016-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8330 Puducherry 34 17 2011 5 1 2011 2011-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8331 Puducherry 34 17 2016 5 1 2016 2016-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8332 Puducherry 34 18 2011 5 1 2011 2011-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8333 Puducherry 34 18 2016 5 1 2016 2016-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8334 Puducherry 34 19 2011 5 1 2011 2011-05-01 1 34 ... 186 186 0 0 0 0 186 0 0 186
8335 Puducherry 34 19 2016 5 1 2016 2016-05-01 1 34 ... 186 186 0 0 0 0 186 0 0 186
8336 Puducherry 34 20 2011 5 1 2011 2011-05-01 1 34 ... 10408 10408 0 0 0 0 10408 0 0 10408
8337 Puducherry 34 20 2016 5 1 2016 2016-05-01 1 34 ... 10408 10408 0 0 0 0 10408 0 0 10408
8338 Puducherry 34 21 2011 5 1 2011 2011-05-01 1 34 ... 13537 13537 0 0 0 0 13537 0 0 13537
8339 Puducherry 34 21 2016 5 1 2016 2016-05-01 1 34 ... 13537 13537 0 0 0 0 13537 0 0 13537
8340 Puducherry 34 22 2011 5 1 2011 2011-05-01 1 34 ... 6825 6825 0 0 0 0 6825 0 0 6825
8341 Puducherry 34 22 2016 5 1 2016 2016-05-01 1 34 ... 6825 6825 0 0 0 0 6825 0 0 6825
8342 Puducherry 34 23 2011 5 1 2011 2011-05-01 1 34 ... 738 4271 0 0 0 0 4271 0 0 4271
8343 Puducherry 34 23 2016 5 1 2016 2016-05-01 1 34 ... 4271 4271 0 0 0 0 4271 0 0 4271
8344 Puducherry 34 24 2011 5 1 2011 2011-05-01 1 34 ... 26396 0 0 0 28482 0 0 28482 0 28482
8345 Puducherry 34 24 2016 5 1 2016 2016-05-01 1 34 ... 28482 0 0 0 28482 0 0 28482 0 28482
8346 Puducherry 34 25 2011 5 1 2011 2011-05-01 1 34 ... 27897 0 0 0 30126 0 0 30126 0 30126
8347 Puducherry 34 25 2016 5 1 2016 2016-05-01 1 34 ... 30126 0 0 0 30126 0 0 30126 0 30126
8348 Puducherry 34 26 2011 5 1 2011 2011-05-01 1 34 ... 23458 0 0 0 22833 0 0 22833 0 22833
8349 Puducherry 34 26 2016 5 1 2016 2016-05-01 1 34 ... 2851 0 0 0 22833 0 0 22833 0 22833
8350 Puducherry 34 27 2011 5 1 2011 2011-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8351 Puducherry 34 27 2016 5 1 2016 2016-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8352 Puducherry 34 28 2011 5 1 2011 2011-05-01 1 34 ... 27852 0 0 0 19623 0 0 19623 0 19623
8353 Puducherry 34 28 2016 5 1 2016 2016-05-01 1 34 ... 2173 0 0 0 19623 0 0 19623 0 19623
8354 Puducherry 34 29 2011 5 1 2011 2011-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8355 Puducherry 34 29 2016 5 1 2016 2016-05-01 1 34 ... 20985 0 0 0 1578 0 0 1578 0 1578
8356 Puducherry 34 30 2011 5 1 2011 2011-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0
8357 Puducherry 34 30 2016 5 1 2016 2016-05-01 1 34 ... 0 0 0 0 0 0 0 0 0 0

8358 rows × 35 columns

In [133]:
# Output to CSV
acdf.to_csv(os.path.join(output_folder, "Assembly_Constituencies_Variables_Categories.csv"), encoding='utf-8', index=False)
In [ ]: