This page uses Pyodide. That means all the Python code you see here is
executed in your browser using WebAssembly. You can run the code
snippets by clicking the "Run Code" button. If you want to run all the
code snippets at once, click the "Run All" button.
Loading Python Console
“An idea that is developed and put into action is more important than idea that
exists only as an idea.”
Project based learning gives a thorough practical exposure to students regarding
a problem upon which the project is based. Through project based learning,
students learn to organise their project and use their time effectively for
successful completion of the project. Projects are developed generally in groups
where students can learn various skills such as working together, problem
solving, decision making, and investigating activities. Project based learning
involves the steps such as analysing the problem, formulating the problem into
small modules, applying the mechanism or method to solve each module and then
integrating the solution of all the modules to arrive at the complete solution
of the problem. To solve a problem, it is required that those who work on it
gather the relevant data and process it by applying a particular method. Data
may be collected as per the requirement of the project in a particular format.
All the team members should be associated to accomplish the task. After
collecting data, it should be processed to solve the problem. The results should
be reported in a predetermined format.
7.2 Approaches for Solving Projects
The approach followed for the development and completion of a project plays a
pivotal role in project based learning. There are several approaches to execute
a project such as modular approach, top down approach and bottom up approach. A
structured or a modular approach to a project means that a project is divided
into various manageable modules and each of the modules has a well-defined task
to be performed with a set of inputs. This would lead to a set of outputs which
when integrated leads to the desired outcome.
Figure 7.1: Steps in project based learning
Different steps involved in project based learning (Figure 7.1)
are :
Identification of a project
The project idea may come through any
real-life situation. For example, one could think of doing a project for
organising a seminar. One needs to understand the usefulness of the project
and its impact. Students must be encouraged to undertake interdisciplinary
projects.
Defining a plan
Normally for any kind of project, there are several
project members involved in it. One project leader has to be identified. The
roles of project leader and each project member have to be clearly defined.
Students who are performing a project must be assigned with specific
activities. The various tools for executing these activities must be known.
To obtain a better solution, one should always think of the extreme
situations.
Fixing of a time frame and processing
Every project is a time relevance
project. A student must understand the importance of time frame for
completion of the project. All the activities which are performed in the
projects require a certain amount of time. Every project must be well
structured and at the same time it must be flexible in its time frame.
Providing guidance and monitoring a project
Many times, the participants
in the project get stuck up with a particular process and it becomes
impossible to proceed further. In such a case, they need guidance, which can
be obtained from various resources such as books, websites and experts in the
field. While it is essential that the project leader should ensure monitoring
of the project, the guide teacher also helps in monitoring the project.
Outcome of a project
One needs to understand thoroughly the outcome of a
project. The outcome can be single, or it can be multiple. The output of a
project can be peer reviewed and can be modified as per the feedback from the
guide teacher or other users.
7.3 Teamwork
Many real-life tasks are very complex and require a lot of individuals to
contribute in achieving them. Efforts made by individuals collectively to
accomplish a task is called teamwork.
For example, in many sports, there is a team of players. These players play
together to win a match. Take an example of a cricket team. We find that even if
a bowler bowls a good ball but if the fielder cannot take a catch then the
wicket cannot be taken. So, in order to take a catch, efforts of a bowler as
well as of fielders are needed. To win a cricket match, contributions from all
the team members in all the three areas batting, bowling and fielding are
required.
7.3.1 Components of Teamwork
Apart from technical proficiency, a wide variety of other components make a
successful teamwork. It comprises skilled team members with specific roles to
achieve the goal.
(A) Communicate with Others
When a group of individuals perform one job, it is necessary to have effective
communication between the members of the team. Such communication can be done
via e-mails, telephones or by arranging group meetings. This helps the team
members to understand each other and sort out their problems to achieve the goal
effectively.
(B) Listen to Others
It is necessary to understand the ideas of others while executing a job
together. This can be achieved when the team members listen to each other in
group meetings and follow steps that are agreed upon.
(C) Share with Others
Ideas, images and tools need to be shared with each other in order to perform a
job. Sharing is an important component of teamwork. Any member of the team who
is well versed in a certain area should share the expertise and experience with
others to effectively achieve the goal within the time frame.
(D) Respect for Others
Every member of the team must be treated respectfully. All the thoughts and
ideas that are put forth in the group meetings may be respected and duly
considered. Not respecting the views of a particular member may cause problems
and that particular team member may not give his best.
(E) Help Others
A helping hand from every member is a key to success. Sometimes help from people
who are not a part of the team is also obtained in order to accomplish a job.
(F) Participate
All the team members must be encouraged by each other to participate in
completing the project and also in discussions in group meetings. Also, every
member should take an active participation so that they feel their importance in
the team.
7.4 Project Descriptions
In this section, some examples of project works are given, which can be taken up
in groups under project based learning. However, a group may choose any other
project in consultation with the guide teacher.
7.4.1 Project I : Online Shopping Platform
Description
Murugan plans to launch an online shopping platform— ‘APPAREL EASY’. He plans to
have two broad categories of merchandise—Men, Women. Under both the categories—
Clothing, Footwear and Accessories will be the sub-categories. Also, on his
shopping platform, he is planning to launch two mega events— Festive Sale (a
month before Diwali to Christmas), End of Season Sale (February and August).
Murugan also wants to keep a record of his monthly revenue generation sales and
category wise sales, with special focus on mega events. A record should also be
kept on discounts being offered by the manufacturers, payment sites or any
discount offered as a promotional campaign by the APPAREL EASY portal.
Specifications
The details of the Men and Women apparels should be stored in a data file with
fields as Apparel Code, Name, Category, Size, Price, Customer Name, Payment
Mode, Discount Code, etc.
If the Category is Men, then apparels can be Men’s Trousers, Men’s Shirt, Men’s
Jeans, Men’s T-shirt. If the Category is Women, then the apparels can be Skirts,
Top, Pants, Jeans, Kurta, etc.
If the Payment Mode is Credit or Debit Card, then the Credit card number, name,
CVV and validity should be entered.
If the Payment Mode is Cash on Delivery(COD), then no details to be asked.
Randomly select the merchandise to be put on sale. The selected merchandise
should not be more than 70 per cent of the total merchandise.
The discount code can be either FEST (for Festive) or EOS (for End of Season).
The discounts for FEST will be 10 per cent and for EOS will be 15 per cent. You
need to visualise the data structure, keeping all the requirements of Murugan in
mind, and then implement it using Python Pandas. Thereafter, you need to design
a software to store details of the merchandise to put them online for sale. At
the same time, records of customers visiting the e-commerce site and the number
of customers placing the order also have to be maintained. The data collected
should be plotted appropriately to help Murugan make decisions for future
marketing and promotion strategies.
7.4.2 Project II: Automating a Books Donation Camp
Description
Realising the importance of Reduce, Reuse and Recycle, the Bookworm club every
year organises a Book Donation Camp. The Book Donation camp collects books and
notebooks. The volunteers assess the condition of the books and categorise them
as Fit, Needs mending, or Unfit. The unfit books’ pages are used to create paper
bags and envelopes. The other categories of books are resold at half the price.
They accept notebooks that have pages left in them. The pages are torn from the
notebooks, and are attractively bound to create a new notebook and sold. They
create a variety of recycled objects and sell them. They want to create a
software for this purpose and store details about the camp. To be able to
efficiently store, retrieve and visualise data, they need to implement the
following using Pandas.
Specification
The details of collections are stored in a CSV file with column headings as Item
category, Item ID, Item name, Item type, Condition.
If the Item Category is Book, then the Item Type can be either Academic or Non
Academic, and Item Id shall be prefixed with a ‘B’. In case of Academic, class
shall be entered.
If the Item Category is Notebook then the Item can be Single line, Four Line,
Five Line, and Item Id shall be prefixed with an ‘N’.
Condition can only be Fit, Needs Mending or Unfit. After the items are
refurbished, the data are stored in another CSV file containing the following
column headings: Item id, Item name, Item Category, Quantity, Price. Item
Category can be Paper bags, Notebook, Books. In case of books Class is also to
be entered.
Another CSV file to store orders is created that stores Item Category, Item
name, Quantity and Price. In case of an order, the refurbished CSV shall update
the quantity.
To ensure effective decision making, it is required that different data are
plotted using appropriate plots to show sales, items refurbished, and items
collected.
7.4.3 Project III: A survey of the effect of social networking sites on behaviour of teenagers
Description
With the Internet revolution everyone today is now connected. Teenagersspend a
good amount of time on social networking sites, and it plays a vital role in
their behaviour. It is considered that excessive use of social networking sites
has sometimes a serious impact on the mental health of individuals. A
well-crafted survey questionnaire can help in exploring and finding many facts.
Specifications
Create a survey questionnaire using any of the freely available online tools
(such as google forms) and store the responses in a CSV file.
Prepare some data analysis questions that you expect them to answer
Import the CSV file in Pandas DataFrame
Perform statistical computation such as mean, median, etc., with respect to
the identified questions
Visualise the findings of the survey using appropriate charts.
7.4.4 Project IV: Utilising an open data source to use a national, state or district level Dataset
Data about the total, rural or urban areas of a state or UT.
Adolescent and youth
Data for different age groups
Total Male
Total number of males
Total Female
Total number of females
SC-M
Total number of males of Scheduled Castes(SC)
SC-F
Total number of females of Scheduled Castes(SC)
ST-M
Total number of males of Scheduled Tribes(ST)
ST-F
Total number of females of Scheduled Tribes(ST)
Literates-M
Total number of literate males
Literates-F
Total number of literate females
LiteratesSC-M
Total number of literate males of Scheduled Castes(SC)
LiteratesSC-F
Total number of literate females of Scheduled Castes(SC)
LiteratesST-M
Total number of literate males of Scheduled Tribes(ST)
LiteratesST-F
Total number of literate females of Scheduled Tribes(ST)
Illiterates-M
Total number of illiterate males
Illiterates-F
Total number of illiterate females
IlliteratesSC-M
Total number of illiterate males of Scheduled Castes(SC)
IlliteratesSC-F
Total number of illiterate females of Scheduled Castes(SC)
IlliteratesST-M
Total number of illiterate males of Scheduled Tribes(ST)
IlliteratesST-F
Total number of illiterate females of Scheduled Tribes(ST)
MainWorker-M
Total number of main worker males
MainWorker-F
Total number of main worker females
MainWorkerSC-M
Total number of main worker males of Scheduled Castes(SC)
MainWorkerSC-F
Total number of main worker females of Scheduled Castes(SC)
MainWorkerST-M
Total number of main worker males of Scheduled Tribes(ST)
MainWorkerST-F
Total number of main worker females of Scheduled Tribes(ST)
MarginalWorker-M
Total number of marginal worker males
MarginalWorker-F
Total number of marginal worker females
MarginalWorkerSC-M
Total number of marginal worker males of Scheduled Castes(SC)
MarginalWorkerSC-F
Total number of marginal worker females of Scheduled Castes(SC)
MarginalWorkerST-M
Total number of marginal worker males of Scheduled Tribes(ST)
MarginalWorkerST-F
Total number of marginal worker females of Scheduled Tribes(ST)
Specifications
On such a large dataset, various types of questions can be answered by doing
different analysis of data. Following is a list of some of the possible queries
that can be answered by analysing the dataset:
What is the total population, total male population and total female
population aged 10 to 24 in India?
Which State or Union Territory in India has the maximum number of illiterates
in the youth ages?
What is the percentage of people working as a marginal worker?
List the top 5 states or union territories which have the maximum population
working as a marginal worker.
Compare the sex ratio of urban areas and rural areas using appropriate graph.
Which state has the highest and the lowest percentage of literate Scheduled
Tribes and Scheduled Castes?
For each state, compare the no. of female marginal workers with no. of male
marginal workers. Use appropriate graphs.
What percentage of Scheduled Tribes lives in urban areas? Draw a pie chart
showing the proportion of literate and illiterates scheduled tribes living in
urban areas.
What is the state wise ratio of literates vs. illiterates in all age groups?
Which state is home to the maximum no. of ST in India? Which state has the
minimum no. of ST in India?
For each state, find the no. of literate females and no. of literate males.
Draw a bar graph for the same. Which state has the highest ratio of literate
female vs literate male and which state has the minimum?
A project work can be carried out by taking any 4-5 of the above questions and
any other similar questions, and solving them step-by-step, with detailed
explanation and documentation. As an example, in the following pages, we will
solve the first question. This will give us an idea about how the other
questions are to be answered.
Task 1
What is the total population, total male population and total female population
aged 10 to 24 in India?
Solution
Prerequisite: we need to first download the CSV file through the QR code
given at the beginning of this chapter.
Read the CSV file in a DataFrame
Check the shape of the DataFrame
View the columns
Filter data
a. Identify the columns that you wants to use for plotting
b. Identify the number of rows required for plotting
Create a new DataFrame containing the filtered data
Rename the columns for ease of use
Group data as per the requirement
Plot data as a barchart for the DataFrame obtained in Step 7.
Let us now write the code for the above identified steps:
Import required libraries.
import pandas as pd
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.pyplot as plt
# Add path to the CSV file in your computer
data = pd.read_csv("PCA_AY_2011_Revised.csv")
df = pd.DataFrame(data)
Check shape of the DataFrame.
print(df.shape)
print(df.shape)
We get the output showing the dataset contains 12168 rows and 123 columns.
Display the columns.
print(df.columns.values)
print(df.columns.values)
A part of the output produced for the 123 columns is shown below:
['Table No.' 'State Code' 'District Code' 'Area Name
'Total/ Rural/ Urban' 'Adolescent and youth categories'
'Total Population - Persons' 'Total Population - Males'
'Total Population - Females' 'Scheduled Caste - Persons'
'Scheduled Caste - Males' 'Scheduled Caste - Females'
...
'Scheduled Tribe Marginal Worker - Household Industry - Males'
'Scheduled Tribe Marginal Worker - Household Industry - Females'
'Scheduled Tribe Marginal Worker - Other Workers - Persons'
'Scheduled Tribe Marginal Worker - Other Workers - Males'
'Scheduled Tribe Marginal Worker - Other Workers - Females']
Filter Data.
a. Identify the columns that you want to use for plotting. For our
analysis, we will consider only the columns ‘Area Name’;
‘Total/Rural/Urban’, ‘Adolescent and youth categories’, and ‘Total
Population - Persons’ .
b. Identify the number of rows required for plotting. In order to decide
the number of rows, we needs to check the values in the column ‘Area Name’
print(df['Area Name'])
print(df['Area Name'])
The following is the output:
0 INDIA
1 INDIA
2 INDIA
3 INDIA
4 INDIA
...
12163 District - South Andaman (03)
12164 District - South Andaman (03)
12165 District - South Andaman (03)
12166 District - South Andaman (03)
12167 District - South Andaman (03)
Name: Area Name, Length: 12168, dtype: object
Create a new DataFrame containing the filtered data.
Suppose, we want to consider data for ‘Area Name’ = ‘INDIA’ only, Therefore,
we shall create a new DataFrame df1 containing only the filtered data, using
the following syntax:
In the above statement, df [‘Area Name’] is used to select the required
rows.We apply slicing on column labels to select the columns starting from
‘Area Name’ till ‘Total Population — Females’
The names of the columns in the DataFrame are too long.
The following statement can be used to rename the columns.
We decided to plot TotalPop, MalePop, FemalePopwith respect to Category. But,
on inspecting the DataFrame df1 we have noticed that the Category column
contains data under six different categories — ‘10-14’, ‘15-19’, ‘20-24’,
‘Adolescent (10-19)’, ‘All Ages’, ‘Youth (15-24)’.
print(df1)
print(df1)
Therefore, to plot TotalPop, MalePop, FemalePop, we should do grouping of
these six categories and find the sum for each type of population. This will
help to provide a complete picture. The GROUP BY() function when applied on
the column ‘Category’ on our DataFrame df1, gives us the following result:
d = df1.groupby("Category").sum()
print(d)
d = df1.groupby("Category").sum()
print(d)
We are interested only in the categories ‘10-14’, ‘15- 19’ and ‘20-24’. So,
let us drop the remaining rows using the following Python statement
d = d.drop(
["Adolescent (10-19)", "All Ages", "Youth (15-24)"],
axis=0,
)
print(d)
d = d.drop(
["Adolescent (10-19)", "All Ages", "Youth (15-24)"],
axis=0,
)
print(d)
Plot the data as a barchart for the DataFrame obtained in Step 7.
d.plot(kind='bar')
plt.show()
d.plot(kind='bar')
plt.show()
The barchart shown at Figure 7.2 is produced as the output. The value (1e8)
marked at the top is offset that is being displayed for the y axes which
corresponds to scientific notation which is used for numbers outside a
specified range.
Figure 7.2: Barchart showing population in different categories