Commit 822c7646 authored by Manas Gabani's avatar Manas Gabani

text labels added for trend facilities plot

parent 96408b66
......@@ -38,7 +38,7 @@
<div class="cards">
<div class="card">
<div class="box">
<h1>{% print(facilities_summary['enrolment_lt_50']) %}194</h1>
<h1>{% print(facilities_summary['enrolment_lt_50']) %}</h1>
<h3>Enrolment &lt;= 50</h3>
</div>
<div class="icon-case">
......@@ -47,7 +47,7 @@
</div>
<div class="card">
<div class="box">
<h1>{% print(facilities_summary['drinking_water']) %}3</h1>
<h1>{% print(facilities_summary['drinking_water']) %}</h1>
<h3>Schools with Drinking Water</h3>
</div>
<div class="icon-case">
......@@ -65,7 +65,7 @@
</div>
<div class="card">
<div class="box">
<h1>{% print(facilities_summary['ramp']) %}50</h1>
<h1>{% print(facilities_summary['ramp']) %}</h1>
<h3>Schools with Ramp</h3>
</div>
<div class="icon-case">
......@@ -74,7 +74,7 @@
</div>
<div class="card">
<div class="box">
<h1>{% print(facilities_summary['single_classroom']) %}3</h1>
<h1>{% print(facilities_summary['single_classroom']) %}</h1>
<h3>Single Classroom Schools</h3>
</div>
<div class="icon-case">
......
......@@ -189,13 +189,25 @@ def total_schools_for_facilities(output_filename, input_df, state_code):
df_ramp = df_sum.loc[(df_sum['Sub_Dimension'] == "Schools with Ramp")]
df_single_classroom = df_sum.loc[(df_sum['Sub_Dimension'] == "Single Classroom Schools")]
df_single_teacher = df_sum.loc[(df_sum['Sub_Dimension'] == "Single Teacher Schools")]
plt.plot(df_enrolment_lt_50['Year'], df_enrolment_lt_50['total'], color='r', label='Enrolment <= 50')
plt.plot(df_drinking_water['Year'], df_drinking_water['total'], color='g', label='Schools with Drinking Water')
plt.plot(df_girls_toilet['Year'], df_girls_toilet['total'], color='b', label='Schools with Girls\' Toilet')
plt.plot(df_ramp['Year'], df_ramp['total'], color='y', label='Schools with Ramp')
plt.plot(df_single_classroom['Year'], df_single_classroom['total'], color='c', label='Single Classroom Schools')
plt.plot(df_single_teacher['Year'], df_single_teacher['total'], color='m', label='Single Teacher Schools')
plt.plot(df_enrolment_lt_50['Year'], df_enrolment_lt_50['total'], marker='o', color='r', label='Enrolment <= 50')
for x, y in zip(df_enrolment_lt_50['Year'],df_enrolment_lt_50['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='r', rotation=15, fontsize=7, weight='bold')
plt.plot(df_drinking_water['Year'], df_drinking_water['total'], marker='+', color='g', label='Schools with Drinking Water')
for x, y in zip(df_drinking_water['Year'],df_drinking_water['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='g', rotation=15, fontsize=7, weight='bold')
plt.plot(df_girls_toilet['Year'], df_girls_toilet['total'], marker='*', color='b', label='Schools with Girls\' Toilet')
for x, y in zip(df_girls_toilet['Year'],df_girls_toilet['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='b', rotation=15, fontsize=7, weight='bold')
plt.plot(df_ramp['Year'], df_ramp['total'], marker='d', color='y', label='Schools with Ramp')
for x, y in zip(df_ramp['Year'],df_ramp['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='y', rotation=15, fontsize=7, weight='bold')
plt.plot(df_single_classroom['Year'], df_single_classroom['total'], marker='s', color='c', label='Single Classroom Schools')
for x, y in zip(df_single_classroom['Year'],df_single_classroom['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='c', rotation=15, fontsize=7, weight='bold')
plt.plot(df_single_teacher['Year'], df_single_teacher['total'], marker='x', color='m', label='Single Teacher Schools')
for x, y in zip(df_single_teacher['Year'],df_single_teacher['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='m', rotation=15, fontsize=7, weight='bold')
plt.legend()
plt.title(label='State: ' + state_name, loc="right", fontsize=10, fontstyle='italic')
......@@ -261,12 +273,24 @@ def total_schools_for_facilities_overall(output_filename, input_df):
df_single_classroom = df_sum.loc[(df_sum['Sub_Dimension'] == "Single Classroom Schools")]
df_single_teacher = df_sum.loc[(df_sum['Sub_Dimension'] == "Single Teacher Schools")]
plt.plot(df_enrolment_lt_50['Year'], df_enrolment_lt_50['total'], color='r', label='Enrolment <= 50')
plt.plot(df_drinking_water['Year'], df_drinking_water['total'], color='g', label='Schools with Drinking Water')
plt.plot(df_girls_toilet['Year'], df_girls_toilet['total'], color='b', label='Schools with Girls\' Toilet')
plt.plot(df_ramp['Year'], df_ramp['total'], color='y', label='Schools with Ramp')
plt.plot(df_single_classroom['Year'], df_single_classroom['total'], color='c', label='Single Classroom Schools')
plt.plot(df_single_teacher['Year'], df_single_teacher['total'], color='m', label='Single Teacher Schools')
plt.plot(df_enrolment_lt_50['Year'], df_enrolment_lt_50['total'], marker='o', color='r', label='Enrolment <= 50')
for x, y in zip(df_enrolment_lt_50['Year'],df_enrolment_lt_50['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='r', rotation=15, fontsize=7, weight='bold')
plt.plot(df_drinking_water['Year'], df_drinking_water['total'], marker='+', color='g', label='Schools with Drinking Water')
for x, y in zip(df_drinking_water['Year'],df_drinking_water['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='g', rotation=15, fontsize=7, weight='bold')
plt.plot(df_girls_toilet['Year'], df_girls_toilet['total'], marker='*', color='b', label='Schools with Girls\' Toilet')
for x, y in zip(df_girls_toilet['Year'],df_girls_toilet['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='b', rotation=15, fontsize=7, weight='bold')
plt.plot(df_ramp['Year'], df_ramp['total'], marker='d', color='y', label='Schools with Ramp')
for x, y in zip(df_ramp['Year'],df_ramp['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='y', rotation=15, fontsize=7, weight='bold')
plt.plot(df_single_classroom['Year'], df_single_classroom['total'], marker='s', color='c', label='Single Classroom Schools')
for x, y in zip(df_single_classroom['Year'],df_single_classroom['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='c', rotation=15, fontsize=7, weight='bold')
plt.plot(df_single_teacher['Year'], df_single_teacher['total'], marker='x', color='m', label='Single Teacher Schools')
for x, y in zip(df_single_teacher['Year'],df_single_teacher['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='m', rotation=15, fontsize=7, weight='bold')
plt.legend()
plt.title(label='KPI: Number of Schools', loc="right", fontsize=10, fontstyle='italic')
......@@ -291,12 +315,12 @@ def get_index_summary(input_df):
def get_dimension_wise_summary(input_df, state_code, main_dimension):
latest_year = max(input_df['Year'])
df_fil = input_df[input_df['State_Code']==state_code]
total = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year)]['total'])
df_fil = input_df[(input_df['State_Code']==state_code) & (input_df['Year']==latest_year)]
total = sum(df_fil[df_fil['Main_Dimension']==main_dimension]['total'])
if main_dimension in ['Elementary Enrolment by School Category','Teachers by School Category','School by Category']:
govt = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Government')]['total'])
private = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Private')]['total'])
others = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Madrasas & Unrecognised')]['total'])
govt = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Government')]['total'])
private = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Private')]['total'])
others = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Madrasas & Unrecognised')]['total'])
return {
'total': int(total),
'govt': int(govt),
......@@ -304,9 +328,9 @@ def get_dimension_wise_summary(input_df, state_code, main_dimension):
'others': int(others)
}
elif main_dimension=='Total Classrooms':
good = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Good Condition')]['total'])
minor_repair = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Need Minor Repair')]['total'])
major_repair = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Need Major Repair')]['total'])
good = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Good Condition')]['total'])
minor_repair = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Need Minor Repair')]['total'])
major_repair = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Need Major Repair')]['total'])
return {
'total': int(total),
'good': int(good),
......@@ -314,12 +338,12 @@ def get_dimension_wise_summary(input_df, state_code, main_dimension):
'major_repair': int(major_repair)
}
else:
enrolment_lt_50 = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Enrolment <= 50')]['total'])
drinking_water = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Schools with Drinking Water')]['total'])
girls_toilet = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Schools with Girls\' Toilet')]['total'])
ramp = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Schools with Ramp')]['total'])
single_classroom = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Single Classroom Schools')]['total'])
single_teacher = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Year']==latest_year) & (df_fil['Sub_Dimension']=='Single Teacher Schools')]['total'])
enrolment_lt_50 = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Enrolment <= 50')]['total'])
drinking_water = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Schools with Drinking Water')]['total'])
girls_toilet = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Schools with Girls\' Toilet')]['total'])
ramp = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Schools with Ramp')]['total'])
single_classroom = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Single Classroom Schools')]['total'])
single_teacher = sum(df_fil[(df_fil['Main_Dimension']==main_dimension) & (df_fil['Sub_Dimension']=='Single Teacher Schools')]['total'])
return {
'enrolment_lt_50': int(enrolment_lt_50),
'drinking_water': int(drinking_water),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment