0% found this document useful (0 votes)
16 views18 pages

2

Uploaded by

mafeenak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views18 pages

2

Uploaded by

mafeenak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

CONTENTS

1. ACKNOWLEDGEMENT
2. INTRODUCTION ABOUT PYTHON

3. OBJECTIVES OF THE PROJECT

4. CONCEPTS USED

5. HARDWARE AND SOFTWARE REQUIREMENTS

6. CSV FILES USED

7. SOURCE CODE

8. OUTPUT

9. CONCLUSION

10. BIBLIOGRAPHY
ACKNOWLEDGEMENT

I am overwhelmed to express my thanks to The Management and the


Administrative Department for providing me all the infrastructures needed for
completing this project in school itself.

I express my deep sense of gratitude to our Principal Mrs Anjali Shashikumar


Ma’am who have been continuously motivating and extending their helping
hand to us.

It is with pleasure that I acknowledge my sincere gratitude to our teacher Mrs


Thasnim P A, who have reviewed my project and helped in solving each and
every problem, occurred during the implementation of the project.

The guidance and support received from all the members of the project team,
was vital for the success of the project. I am grateful for their constant support
and help.
INTRODUCTION ABOUT PYTHON

Python is a popular programming language. It was created by Guido van


Rossum, and released in 1991.It is used for, web development (server-side),
software development, mathematics, system scripting etc. Python can be used
on a server to create web applications. It can connect to database systems. It can
also read and modify files. Python can be used to handle big data and perform
complex mathematics. Python can be used for rapid prototyping, or for
production-ready software development.

Why Python?

Python works on different platforms (Windows, Mac, Linux, Raspberry Pi,


etc.).

Python has a simple syntax similar to the English language.

Python has syntax that allows developers to write programs with fewer lines
than some other programming languages.

Python runs on an interpreter system, meaning that code can be executed as


soon as it is written. This means that prototyping can be very quick.

Python can be treated in a procedural way, an object-oriented way or a


functional way.
OBJECTIVES OF THE PROJECT

The primary objective of this project is to create a user-friendly and efficient


tool for managing and analyzing population data for various countries. The
specific goals include:

1. Data Management:
o Provide users the ability to view, add, search, and delete country-
specific population data.
o Ensure that any modifications (such as adding or deleting country
details) are saved permanently in a CSV file.
2. Data Visualization:
o Help users visualize population-related information through
different types of plots:
 Line Plot for tracking yearly population change across
countries.
 Bar Chart for comparing population sizes of different
countries.
 Histogram for analyzing the distribution of net population
changes.
3. User Interaction:
o Develop a menu-driven interface that is easy for users to navigate,
allowing them to perform various data operations with minimal
effort.
4. Data Analysis:
o Allow users to sort and filter data (e.g., top 3 countries with the
highest and lowest population) to gain insights.
o Help users explore population trends and make informed
conclusions based on the visualized data.

In essence, the project aims to simplify the process of managing and analysing
population data while offering meaningful insights through visual
representation, making it a useful tool for understanding global or regional
population dynamics.
CONCEPTS USED IN THE PROJECT

1. Data analysis and manipulation using data frames in pandas

Among its scientific computation libraries, Pandas to be the most useful for data
science operations.

As well as offering a convenient storage interface for labelled data, Pandas


implements a number of powerful data operations familiar to users of both database
frameworks and spreadsheet programs.

Pandas is a popular Python package for data science, and with good reason: it offers
powerful, expressive and flexible data structures that make data manipulation and
analysis easy, among many other things. The DataFrame is one of these structures.

DataFrames in Python are very similar: they come with the Pandas library, and they
are defined as two dimensional labelled data structures with columns of potentially
different types.

2. Data Visualization using Matplotlib package

Data visualization is the graphical representation of data in order to interactively and


efficiently convey insights to clients, customers, and stakeholders in general.

Visualizations are the easiest way to analyse and absorb information. Visuals help to
easily understand the complex problem. They help in identifying patterns,
relationships, and outliers in data. It helps in understanding business problems better
and quickly.

Matplotlib is a 2-D plotting library that helps in visualizing figures. Matplotlib


emulates graphs and visualizations. So, matplotlib in Python is used as it is a robust,
free and easy library for data visualization.

3.CSV FILES

A CSV is a comma-separated values file, which allows data to be saved in a tabular


format. CSVs look like a garden-variety spreadsheet but with a. csv extension. CSV
files can be used with most any spreadsheet program, such as Microsoft Excel
4.FLOW OF CONTROL

The control flow of a Python program is regulated by conditional statements, loops,


and function calls. It is implemented through loops in python program. In Python,
While Loops is used to execute a block of statements repeatedly until a given
condition is satisfied. And when the condition becomes false, the line immediately
after the loop in the program is executed. While loop falls under the category of
indefinite iteration.

HARDWARE AND SOFTWARE REQUIREMENTS

HARDWARE:

 GENUINE INTEL: Intel® Core™[email protected]


 MEMORY: 4.00GB
 HARD DISK: 400GB
 CD/DVD/PEN DRIVE
 MONITOR 14.1 or 15 -17 INCH KEYBOARD AND MOUSE
 PRINTER

SOFTWARE

 PLATFORM: Microsoft Windows


 PYTHON LIBRARIES: PANDAS, MATPLOTLIB, NUMPY
 PYTHON IDLE 3.8 OR ABOVE
 JUPYTER NOTEBOOK
 PYDROID 3
 MS EXCEL OR GOOGLE SHEETS
 MS OFFICE
Source code
import matplotlib. pyplot as plt
import pandas as pd
import numpy as np
df=pd.read_csv ('Population.csv')
cname=df [ ' Cname ']
pop=df [ ' Pop' ]
ycp=df ['Ychange' ]
nc=df ['Ntotal']
den=df [ ' Density' ]
ma=df [ 'Mage' ]
lae=df ['Area' ]
upp=df ['Urban' ]
while True:
print ("**************************************************")
print ("POPULATION ANALYSIS")
print ("**************************************************")
print ("1: TO DISPLAY ALL COUNTRY DETAILS")
print ("2: TO ADD NEW COUNTRY DETAILS")
print ("3 : TO SEARCH FOR A COUNTRY DETAILS")
print (' 4:TO DROP A COUNTRY DETAILS')
print ('5. Display the details of 3 countries of highest population')
print (' 6. Display the details of 3 countries with lowest population')
print ('7. Display all details in the ascending order of population')
print ('8. Line plot showing country name and yearly change in population')
print ('9.Bar plot showing country and population')
print ('10. Histogram showing net total and no of countries')
print ('11. Exit' )
ch=int (input ("ENTER YOUR CHOICE:") )
if ch == 1:
print (" \nTHE DETAILS OF population")
print (df)
elif ch == 2:
print ('Please enter the following details')
cname=input ('Enter the country name')
print (' Enter the country details: ')
pop=(input ('Population:') )
ycp=(input ('Yearly Change %: ') )
nc=int (input ('Net Change: ') )
den=int (input (' Density:') )
lae=int (input ('Land Area: ') )
ma=int (input ( 'Med. Age: ') )
upp=(input ('Urban Pop %: ') )
data={ ' Cname ' : cname, ' Pop' : pop, ' Ychange' : ycp, 'Ntotal ' : nc, '
Density ' : den,
'Area' : laer, 'Mage' : ma, 'Urban ' : upp}
df = df. append (data, ignore_index=True)
df. to_csv ('population. csv' , index=False)
print ('New details are succesfully added' )
elif ch == 3:
an=input ('Enter the Country name: ')
df=pd.read_csv(' Population. csv' )
asf=df. loc[df ['Cname' ] == an]
print (asf)
elif ch == 4:
df=pd.read_csv('Population.csv')
print (df)
print ('Which country details you want to drop?')
name=input ('Enter the country name: ')
indx=df [df ['Cname' ] == name] . index
df.drop (indx, inplace = True)
df. to_csv('population.csv', index=False)
print ('Record Deleted .... ')
elif ch == 5:
print ('The details of 3 countries of highest population')
print (df. sort_values('Pop', ascending=False) . head (3) )
elif ch == 6:
print ('The details of 3 countries with lowest population')
print (df. sort_values ('Pop', ascending=False) . tail (3))
elif ch == 7:
print ('Diaplay all details in the ascending order of population')
print (df. sort_values ('Pop') )
elif (ch == 8) :
plt.plot (cname, ycp, label='change', color='r', linestyle='-')
plt.xticks ( np. arange (0, 11, 1), fontsize=12, rotation=30)
plt. xlabel ('name of the country', fontsize=16)
plt.ylabel ( 'yearly change in population', fontsize=16)
plt.legend (loc ='upper left')
plt.title ( 'world population growth in different years', fontsize=16)
plt.grid (True)
plt. show ()
elif ch == 9:
plt.bar (cname, pop, label=' country and population', color='blue')
plt.xticks ( np. arange (0, 11, 1), fontsize=12, rotation=30)
plt. title ('Bar chart of country and population', fontsize=20)
plt.xlabel ('country', fontsize=20)
plt. ylabel ('population (in crores) ', fontsize=20)
plt.grid (True)
plt. show ()
elif ch == 10:
plt.hist (nc, bins = 10, range=(1000000,7000000),
edgecolor='orangered', histtype="step")
plt.xlabel ('Net total', fontsize=16)
plt. ylabel ('No of countries', fontsize=16)
plt.grid (True)
plt. title ( 'Histogram showing net total and no of countries', fontsize=16)
plt.show ()
elif ch == 11:
break
else :
print ('wrong input' )
OUTPUT
CONCLUSION
The Population Analysis program offers a comprehensive tool for population
data analysis. It allows users to manipulate the dataset by adding, deleting, or
searching for country details and provides meaningful insights through various
visualizations. The code structure is optimized to read the data only once and
update it efficiently. It ensures that users have an easy-to-use interface for
analysing and visualizing population data.

The program uses a simple menu that makes it easy for users to choose what
they want to do. The code ensures that any changes made (like adding or
deleting country data) are saved properly.

By providing both data management and visualization options, the program


helps users better understand global population trends. It is flexible and can be
improved further by adding new features or better validation of input data.

In summary, this is a user-friendly tool for population analysis that offers


helpful features for exploring and visualizing country-level population data.

Merits

*Records can be stored in fast manner than manual recording.

*Any record can be easily accessible.

*Visual representation of data is available

*Analysis of the data can be done easily


BIBLIOGRAPHY

I have used the following reference to complete my project work.

 Website: www.python.org

 Books Referred:- Informatics Practices With Python by PreetiArora

 Books Referred:- Informatics Practices With Python by SumitaArora

 www.google.com

 W3school.com

You might also like