Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education in INDIA
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Manas
Education in INDIA
Commits
1c41a3c9
Commit
1c41a3c9
authored
Nov 23, 2022
by
Manas Gabani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments added, index page trend updated for classrooms, Presentation added
parent
44eadc7a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
103 deletions
+111
-103
Education_in_INDIA.pptx
Education_in_INDIA.pptx
+0
-0
app.py
app.py
+91
-98
config.py
config.py
+5
-0
utils.py
utils.py
+15
-5
No files found.
Education_in_INDIA.pptx
0 → 100644
View file @
1c41a3c9
File added
app.py
View file @
1c41a3c9
This diff is collapsed.
Click to expand it.
config.py
View file @
1c41a3c9
default_state_code
=
27
# for Maharashtra
fig_size_ds_w
,
fig_size_ds_h
=
10
,
6
# width and height of distribution graphs
fig_size_tr_w
,
fig_size_tr_h
=
8
,
6
# width and height of trend graphs
form_value_to_sub_dimension_mapping
=
{
'govt'
:
'Government'
,
'private'
:
'Private'
,
...
...
utils.py
View file @
1c41a3c9
...
...
@@ -8,9 +8,10 @@ import matplotlib.pyplot as plt
from
babel.numbers
import
format_number
# dict_summary={"top3":[],"bottom3":[]}
fig_size_ds_w
,
fig_size_ds_h
=
10
,
6
fig_size_tr_w
,
fig_size_tr_h
=
8
,
6
fig_size_ds_w
,
fig_size_ds_h
=
10
,
6
# width and height of distribution graphs
fig_size_tr_w
,
fig_size_tr_h
=
8
,
6
# width and height of trend graphs
# to read all raw data csv files
def
read_all_csv
(
path
=
'./rawdata_csv/'
,
extension
=
'csv'
):
result
=
glob
.
glob
(
path
+
'SRC_R*.{}'
.
format
(
extension
))
df
=
None
...
...
@@ -30,6 +31,7 @@ def read_all_csv(path='./rawdata_csv/', extension='csv'):
return
final_df
# to plot statewise distribution graphs
def
statewise_distribution
(
output_filename
,
input_df
,
year
,
ylabel
,
main_dimension
,
sub_dimension
=
''
):
dict_summary
=
{
"top3"
:[],
"bottom3"
:[]}
if
sub_dimension
:
...
...
@@ -65,6 +67,7 @@ def statewise_distribution(output_filename, input_df, year, ylabel, main_dimensi
return
dict_summary
# to plot trend graph for enrolments
def
total_enrolment_by_category
(
output_filename
,
input_df
,
main_dimension
,
state_code
,
ylabel
):
fig
=
plt
.
figure
(
figsize
=
(
fig_size_tr_w
,
fig_size_tr_h
))
df_fil
=
input_df
.
loc
[
input_df
[
'Main_Dimension'
]
==
main_dimension
]
...
...
@@ -97,6 +100,7 @@ def total_enrolment_by_category(output_filename, input_df, main_dimension, state
plt
.
savefig
(
output_filename
)
plt
.
close
(
fig
)
# to plot trend graph for teachers
def
total_teachers_by_main_dimension
(
output_filename
,
input_df
,
main_dimension
,
state_code
):
fig
=
plt
.
figure
(
figsize
=
(
fig_size_tr_w
,
fig_size_tr_h
))
df_fil
=
input_df
.
loc
[
input_df
[
'Main_Dimension'
]
==
main_dimension
]
...
...
@@ -155,6 +159,7 @@ def total_teachers_by_main_dimension(output_filename, input_df, main_dimension,
plt
.
savefig
(
output_filename
)
plt
.
close
(
fig
)
# to plot trend graph for classrooms
def
total_classrooms_by_trend
(
output_filename
,
input_df
,
state_code
):
fig
=
plt
.
figure
(
figsize
=
(
fig_size_tr_w
,
fig_size_tr_h
))
df_fil
=
input_df
.
loc
[
input_df
[
'Main_Dimension'
]
==
"Total Classrooms"
]
...
...
@@ -186,6 +191,7 @@ def total_classrooms_by_trend(output_filename, input_df, state_code):
plt
.
savefig
(
output_filename
)
plt
.
close
(
fig
)
# to plot trend graph for facilities
def
total_schools_for_facilities
(
output_filename
,
input_df
,
state_code
):
fig
=
plt
.
figure
(
figsize
=
(
fig_size_tr_w
,
fig_size_tr_h
))
df_fil
=
input_df
.
loc
[
input_df
[
'Main_Dimension'
]
==
"School Facilities"
]
...
...
@@ -229,6 +235,7 @@ def total_schools_for_facilities(output_filename, input_df, state_code):
plt
.
savefig
(
output_filename
)
plt
.
close
(
fig
)
# to plot trend graph by main_dimension for index page
def
main_dimension_overall
(
output_filename
,
input_df
,
main_dimension
,
ylabel
):
fig
=
plt
.
figure
(
figsize
=
(
fig_size_tr_w
,
fig_size_tr_h
))
df_fil
=
input_df
.
loc
[
input_df
[
'Main_Dimension'
]
==
main_dimension
]
...
...
@@ -255,13 +262,13 @@ def main_dimension_overall(output_filename, input_df, main_dimension, ylabel):
df_major_repair
=
df_sum
.
loc
[(
df_sum
[
'Sub_Dimension'
]
==
"Need Major Repair"
)]
plt
.
plot
(
df_good_cond
[
'Year'
],
df_good_cond
[
'total'
],
marker
=
'o'
,
color
=
'r'
,
label
=
'Good Condition'
)
for
x
,
y
in
zip
(
df_good_cond
[
'Year'
],
df_good_cond
[
'total'
]):
plt
.
text
(
x
=
x
,
y
=
y
,
s
=
'{:.0f}'
.
format
(
y
))
plt
.
text
(
x
=
x
,
y
=
y
,
s
=
'{:.0f}'
.
format
(
y
)
,
color
=
'r'
,
rotation
=
15
,
fontsize
=
7
,
weight
=
'bold'
)
plt
.
plot
(
df_minor_repair
[
'Year'
],
df_minor_repair
[
'total'
],
marker
=
'+'
,
color
=
'g'
,
label
=
'Need Minor Repair'
)
for
x
,
y
in
zip
(
df_minor_repair
[
'Year'
],
df_minor_repair
[
'total'
]):
plt
.
text
(
x
=
x
,
y
=
y
,
s
=
'{:.0f}'
.
format
(
y
))
plt
.
text
(
x
=
x
,
y
=
y
,
s
=
'{:.0f}'
.
format
(
y
)
,
color
=
'g'
,
rotation
=
15
,
fontsize
=
7
,
weight
=
'bold'
)
plt
.
plot
(
df_major_repair
[
'Year'
],
df_major_repair
[
'total'
],
marker
=
'*'
,
color
=
'b'
,
label
=
'Need Major Repair'
)
for
x
,
y
in
zip
(
df_major_repair
[
'Year'
],
df_major_repair
[
'total'
]):
plt
.
text
(
x
=
x
,
y
=
y
,
s
=
'{:.0f}'
.
format
(
y
))
plt
.
text
(
x
=
x
,
y
=
y
,
s
=
'{:.0f}'
.
format
(
y
)
,
color
=
'b'
,
rotation
=
15
,
fontsize
=
7
,
weight
=
'bold'
)
plt
.
legend
()
plt
.
title
(
label
=
'KPI: '
+
ylabel
,
fontweight
=
'bold'
,
fontsize
=
10
,
fontstyle
=
'italic'
)
...
...
@@ -271,6 +278,7 @@ def main_dimension_overall(output_filename, input_df, main_dimension, ylabel):
plt
.
savefig
(
output_filename
)
plt
.
close
(
fig
)
# to plot trend graph by school facilities for index page
def
total_schools_for_facilities_overall
(
output_filename
,
input_df
):
fig
=
plt
.
figure
(
figsize
=
(
fig_size_tr_w
,
fig_size_tr_h
))
df_fil
=
input_df
.
loc
[
input_df
[
'Main_Dimension'
]
==
"School Facilities"
]
...
...
@@ -312,6 +320,7 @@ def total_schools_for_facilities_overall(output_filename, input_df):
plt
.
savefig
(
output_filename
)
plt
.
close
(
fig
)
# to get overall card values for index page
def
get_index_summary
(
input_df
):
latest_year
=
max
(
input_df
[
'Year'
])
students
=
sum
(
input_df
[(
input_df
[
'Main_Dimension'
]
==
'Elementary Enrolment by School Category'
)
&
(
input_df
[
'Year'
]
==
latest_year
)][
'total'
])
...
...
@@ -325,6 +334,7 @@ def get_index_summary(input_df):
'classrooms'
:
format_number
(
int
(
classrooms
),
locale
=
'en_IN'
)
}
# to get dimension wise card values for details page
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
)
&
(
input_df
[
'Year'
]
==
latest_year
)]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment