OLYMPIC ANALYSIS SYSTEM (IP CLASS XII)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 53

<TABLE OF CONTENTS>

Sr. TOPICS Pg.


No. No.
<ACKNOWLEDGEMENT>
<CERTIFICATE>
A. <TERM 1>
1. PREFACE 3
2. OBJECTIVE OF PROJECT 4
3. SYSTEM REQUIREMENTS 3
4. PYTHON LIBRARIES USED 4
5. ABOUT OLYMPICS 5
6. INTRODUCTION 7
7. ABOUT OUR ANALYSIS SYSTEM 8
8. USES OF OUR PROJECT 10
9. HYPOTHESIS 10
10. DEMAND IN REAL WORLD 11
11. BUILT-IN FUNCTION USED 11
12. WHY PYTHON AND CSV? 13
13. LIMITATIONS 14
14. CONCLUSION 14
B. <TERM 2>
16. BACK END PROGRAM 15
17. DATABASE AND TABLE DESIGN 28
18. OUTPUT PROGRAM 29
19. BIBLIOGRAPHY 56

<TOPIC>

OLYMPIC DATA
ANALYSIS SYSTEM
<PREFACE>
The sole reason of making this project is to celebrate
India’s best ever Olympic performance in Tokyo Olympics
2020.
The purpose of this project was to develop the
Management Information System (MIS) and to automate
the record keeping me medals with respective countries.
It mainly consists of computerized database, a collection
of inter related tables/CSV files, capable to produce
different reports according to the user. Using Application
program (Python) or front-end, we can store, manage,
retrieve all information in proper way. The software
being simple in design and working, does not require any
prerequisite training to users, and can be used as a
powerful tool for automating our “Olympic Management
System”.
To make analysis much easier a user friendly interface
was used to keep records of countries in most detailed
and coordinated manner.

3
<OBJECTIVE OF PROJECT>
The main objective of the project including the following:

<Goals to be achieved by this project ?>


Answer) This Analysis system is capable of analyzing
performance of all countries in Olympic, No. of medal won, No.
of times country participated in Olympics visually as well as in
tabular form.

<How it will be helpful to the people associated to the


work ?>
Answer) It helps us to answer question such as:
•What effect does the host country have in the medals won at
the Olympics?
•Is the performance of countries in Olympics games affected by
the economic factors of the country?
•Is the performance of countries in Olympics games affected by
the economic factors of the country?

<How the records will be managed ?>


Answer) The records will be managed by Excel Spreadsheets
(back –end).

4
<SYSTEM REQUIREMENTS>
a) Aim:
To Develop Olympic Games Analysis System
b) Front End:
a. Sublime Text Editor
b. Microsoft Code Studio
c. Python 3.8.2
c) Back End:
My SQL Server 5.1
d) Operating System:
Windows 10
e) Minimum Hardware and Software Requirements:
a. x86 64-bit CPU (Intel / AMD architecture)
b. 4 GB RAM.
c. 5 GB free disk space.
f) Open Source Software being used:
a. Python 3.8.2
i. Pandas
ii. Matplotlib

5
<PYTHON LIBRARIES USED>
<PANDAS>

Pandas is a high-level data manipulation tool developed


by Wes McKinney. It is built on the Numpy package and
its key data structure is called the Data Frame. Data
Frames allow you to store and manipulate tabular data in
rows of observations and columns of variables.
<MATPLOTLIB>

The Matplotlib Python library, developed by John Hunter


and many other contributors, is used to create high-
quality graphs, charts, and figures. The library is
extensive and capable of changing very minute details of
a figure.

6
<ABOUT OLYMPICS>

<INTRODUCTION>
According to historical records, the first ancient Olympic Games can be
traced back to 776 BC. They were dedicated to the Olympian gods and
were staged on the ancient plains of Olympia. They continued for
nearly 12 centuries and still continuing.

<THE GAME AND THE RELIGION>


The Olympic Games were closely linked to the religious festivals of the
cult of Zeus, but were not an integral part of a rite. Indeed, they had a
secular character and aimed to show the physical qualities and
evolution of the performances.

7
<ABOUT OUR
ANALYSIS SYSTEM>

This Analysis system is capable of analyzing performance


of all countries in Olympic, No. of medal won, No. of
times country participated in Olympics visually as well as
in tabular form. And it also helps us to answer question
such as:
•What effect does the host country have in the medals
won at the Olympics?

8
<USES OF OUR
PROJECT>
This program can be used to analyze the performance of
different countries in Olympics till now. This program can also
be used for a predictive model as to which country is likely to
fetch the highest number of gold in a particular sports category
(just an example), etc. This project consists of various graphs to
analyze and represent data which helps the user to draw a
comparison between, and having a glimpse of, different groups.
It also helps get analyzed information in a structured format
making it easy to understand.

<HYPOTHESIS>
In this project of python programming function was used to
make it look more attractive and beautiful and connectivity of
Python and MySQL was much easier to understand in this way
of programming.
Features:
1. Free from technical errors.
2. Time Saving.
3. Reduces manual work.

10
4. Data is analyzed through various methods – sort(),
groupby, mean, median, mode etc.
5. Visualized data, e.g. Bar Chart, Pie Chart, Histogram etc.
6. User – friendly interface.
<DEMAND IN REAL WORLD>
It gives detailed analysis of the following:
1. Countries VS Total Medal
2. Countries VS Total no. of times participated (In Summer &
Winter)
3. Countries VS Total no. of Gold Medals.
4. Countries VS Total no. of Silver Medals.
5. Countries VS Total no. of Bronze Medals.
6. Distribution of Gold, Silver & Bronze Medals.
7. Country wise Gold, Silver & Bronze Medals.
8. Countries VS Total no. of Medals (In Summer & Winter)
Number of Countries (Gold, Silver and Bronze Medals)
<BUILT-IN FUNCTION USED>
<PANDAS>
1. read_csv(): This function is used to read data from csv
files to form a dataframe.
2. head(): Head function is used to fetch n number of rows
from Pandas object.
3. tail(): Tail function returns last n rows from Pandas
object.

11
4. append(): The append method adds an item to the end
of the list.
5. drop(): drop function is used to drop specified labels
from rows and columns
6. rename(): Rename function is used to change name of
any row or column.
7. min(): Min function finds out the minimum value from
given set of data.
8. max(): Max function finds out the maximum value from
given set of data.
9. sort(): Sort function arranges value in Pandas object
ascending and descending order.
10. info(): Info Function is used to print a concise summary
of dataframe.

<MATPLOTLIB>
1. bar(): It is used to plot a bar chart in matplotlib for a
given set of data.
2. hist(): Hist function allows us to create and plot
histogram for a given set of data.
3. xlabel(): It is used to set label for X axis.
4. ylabel(): It is used to set label for Y axis.
5. title(): Title function is used to add title to the plot.
6. show(): It is used at the end to show plot as per given
specification.

12
<WHY PYTHON AND CSV?>
This project (Front – end) has been developed using Python
version 3.8.2 and the Back – end used SQL, CSV file which
is sourced from https://olympics.com

<PYTHON> <CSV>
 Easy-to-learn  Human readable and easy to
edit manually.
 A broad standard library  Simple to implement and parse
 Interactive Mode  Ease of Management

 Portable  Faster to handle

 Databases  Processed by all existing


applications.
<GOOGLE DRIVE LINK FOR BACK – END FILES>
https://drive.google.com/drive/folders/1I6v4J9lDNX2Erc_r8IXF
oOesEnutyPNt?usp=sharing

13
<LIMITATIONS>
Despite being best efforts of the developer, the following
limitations and functional boundaries are visible, which
limits the scope of this application.
1. The software can store records and produce
reports in pre-designed format in soft copy. There
is no facility to produce customized reports.
2. This is an offline project.
The module or function can be designed and
embedded to handle the user need in future. Any part
of the project can be modified without much effort.

<CONCLUSION>
Python is one of the simplest programming languages
that are used for variety of applications.
We can also focus on the areas for regular updates and
version advancements in future of this project.
Completing this project I have received a lot of useful
knowledge.

<THANK YOU>

14
<TERM 2>
<CODING>
<BACK END PROGRAM>

15
16
17
18
19
20
21
22
23
24
25
26
27
<DATABASE AND TABLE DESIGN >

28
<OUTPUT PROGRAM>
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
OLYMPICS GAMES ANALYSIS SYSTEM
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
1- Data Visualisation
2- Data Analysis
3- Read CSV/EXCEL File
4- Import / Export from/to MySQL
5- Data Manipulation
6- Exit
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
Enter your choice: 1

29
====================================
DATA VISUALISATION OF TOP 10 COUNTRIES
====================================
1- Line Chart~> COUNTRIES VS TOTAL MEDALS
2- Line Chart~> COUNTRIES VS TOTAL NO. OF TIMES PARTICIPATED (IN SUMMER &
WINTER)
3- Bar Chart ~> COUNTRIES VS TOTAL NO. OF GOLD MEDALS
4- Bar Chart ~> COUNTRIES VS TOTAL NO. OF SILVER MEDALS
5- Bar Chart ~> COUNTRIES VS TOTAL NO. OF BRONZE MEDALS
6- Pie Chart ~> DISTRIBUTION OF GOLD, SILVER & BRONZE MEDALS
7- Pie Chart ~> COUNTRY WISE GOLD, SILVER & BRONZE MEDALS
8- Bar Chart ~> COUNTRIES VS TOTAL NO. OF MEDALS (IN SUMMER AND WINTER)
9- Histogram ~> NO. OF COUNTRIES (GOLD, SILVER AND BRONZE MEDALS)
10- Exit to Main Menu
===================================
===================================
Please enter your choice: 1

===================================
Please enter your choice: 2

30
===================================
Please enter your choice: 3

===================================

31
Please enter your choice: 4

===================================
Please enter your choice: 5

32
===================================
Please enter your choice: 8

===================================
Please enter your choice: 9

===================================
Please enter your choice: 10

34
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
OLYMPICS GAMES ANALYSIS SYSTEM
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
1- Data Visualisation
2- Data Analysis
3- Read CSV/EXCEL File
4- Import / Export from/to MySQL
5- Data Manipulation
6- Exit
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
Enter your choice: 2
<------------------------->
Data Frame Analysis
<------------------------->
1) To print Records of Top Countries in terms of Total Medals won in Olympics.
2) To print Records of Top Countries in terms of Total Gold Medals won in Olympics.
3) To print Records of Top Countries in terms of Total Silver Medals won in Olympics.
4) To print Records of Top Countries in terms of Total Bronze Medals won in Olympics.
5) To print Records of Bottom-most Countries in terms of Medal won in Olympics
6) To print the General Information about the Dataframe used for Analysis.
7) To Describe the Structure of the Dataframe used for analysis.
8) To print the Data of column specified by the User
9) To print Maximum value for each Column in the Dataframe.
10) To display Gold, Silver and Bronze medals won by a Specific Country"
11) To go back to the main menu
---------x-------------------x------------------x------------------x
Enter your choice : 1
---------x-------------------x------------------x------------------x
Enter the number of records to be displayed : 12
Top 12 records from Dataframe
Country TotalMedal
0 United States 2828

35
1 Soviet Union 1204
2 Great Britain 883
3 Germany 855
4 France 840
5 Italy 701
6 Sweden 652
7 China 608
8 Russia 546
9 Norway 520
10 East Germany 519
11 Australia 512
---------x-------------------x------------------x------------------x
Enter your choice : 2
---------x-------------------x------------------x------------------x
Enter the number of records to be displayed : 10
Top 10 records by total no. of gold medals
Country Tgoldmedal
0 United States 1127
1 Soviet Union 473
2 Germany 283
3 Great Britain 274
4 France 248
5 Italy 246
6 China 237
7 Sweden 202
8 Russia 196
9 East Germany 192
---------x-------------------x------------------x------------------x
Enter your choice : 3
---------x-------------------x------------------x------------------x
Enter the number of records to be displayed : 15
Top 15 records by total no. of silver medals
Country Tsilvermedal
0 United States 907
1 Soviet Union 376
2 Great Britain 299
3 Germany 282

36
4 France 276
5 Sweden 216
6 Italy 214
7 China 195
8 Norway 174
9 Australia 168
10 Canada 166
11 East Germany 165
12 Russia 163
13 Japan 158
14 Hungary 149
---------x-------------------x------------------x------------------x
Enter your choice : 4
---------x-------------------x------------------x------------------x
Enter the number of records to be displayed : 12
Top 12 records by total no. of bronze medals
Country Tbronzemedal
0 United States 794
1 Soviet Union 355
2 France 316
3 Great Britain 310
4 Germany 290
5 Italy 241
6 Sweden 234
7 Canada 198
8 Australia 192
9 Russia 187
10 Japan 183
11 Finland 178
---------x-------------------x------------------x------------------x
Enter your choice : 5
---------x-------------------x------------------x------------------x
Enter the number of records to be displayed : 6
Bottom 6 records from the dataframe
Country TotalMedal
143 Montenegro 1
144 Sudan 1

37
145 Netherlands Antilles 1
146 North Macedonia 1
147 Paraguay 1
148 Tonga 1
---------x-------------------x------------------x------------------x
Enter your choice : 6
---------x-------------------x------------------x------------------x
Information of the dataframe
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 149 entries, 0 to 148
Data columns (total 10 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Country 149 non-null object
1 SummerTimesPart 149 non-null int64
2 WinterTimesPart 149 non-null int64
3 TotalTimesPart 149 non-null int64
4 Tbronzemedal 149 non-null int64
5 Tsilvermedal 149 non-null int64
6 Tgoldmedal 149 non-null int64
7 TotalMedal 149 non-null int64
8 SummerTotal 149 non-null int64
9 WinterTotal 149 non-null int64
dtypes: int64(9), object(1)
memory usage: 11.1+ KB
None
---------x-------------------x------------------x------------------x
Enter your choice : 7
---------x-------------------x------------------x------------------x
Describing the basic characteristics of the dataframe
SummerTimesPart WinterTimesPart TotalTimesPart Tbronzemedal
count 149.000000 149.000000 149.000000 149.000000
mean 14.201342 7.006711 21.154362 43.852349
std 7.134783 7.601117 13.542089 94.307460
min 0.000000 0.000000 1.000000 0.000000
25% 9.000000 0.000000 12.000000 1.000000
50% 14.000000 5.000000 17.000000 7.000000
75% 19.000000 11.000000 28.000000 34.000000

38
max 28.000000 24.000000 51.000000 794.000000

Tsilvermedal Tgoldmedal TotalMedal SummerTotal WinterTotal


count 149.000000 149.000000 149.000000 149.000000 149.000000
mean 41.154362 41.436242 126.442953 105.073826 21.369128
std 98.296004 114.612645 305.458547 263.291768 59.225673
min 0.000000 0.000000 1.000000 0.000000 0.000000
25% 1.000000 0.000000 2.000000 2.000000 0.000000
50% 4.000000 3.000000 14.000000 13.000000 0.000000
75% 31.000000 28.000000 94.000000 87.000000 6.000000
max 907.000000 1127.000000 2828.000000 2523.000000 368.000000
---------x-------------------x------------------x------------------x
Enter your choice : 8
---------x-------------------x------------------x------------------x
Name of the columns~~> Index(['Country', 'SummerTimesPart', 'WinterTimesPart',
'TotalTimesPart', 'Tbronzemedal', 'Tsilvermedal', 'Tgoldmedal', 'TotalMedal',
'SummerTotal', 'WinterTotal'], dtype='object')
Enter the column names in a list['Country','TotalMedal']
Country TotalMedal
0 Afghanistan 2
1 Algeria 17
2 Argentina 74
3 Armenia 14
4 Australasia 12
.. ... ...
144 Vietnam 5
145 Virgin Islands 1
146 Yugoslavia 94
147 Zambia 2
148 Zimbabwe 15

[149 rows x 2 columns]


---------x-------------------x------------------x------------------x
Enter your choice : 9
---------x-------------------x------------------x------------------x
Maximum value for each column
Country North Macedonia

39
SummerTimesPart 28
WinterTimesPart 24
TotalTimesPart 51
Tbronzemedal 794
Tsilvermedal 907
Tgoldmedal 1127
TotalMedal 2828
SummerTotal 2523
WinterTotal 368
dtype: object
---------x-------------------x------------------x------------------x
Enter your choice : 10
---------x-------------------x------------------x------------------x
Name of All countries participating in Olympics
['Afghanistan' 'Algeria' 'Argentina' 'Armenia' 'Australasia' 'Australia'
'Austria' 'Azerbaijan' 'Bahamas' 'Bahrain' 'Barbados' 'Belarus'
'Belgium' 'Bermuda' 'Bohemia' 'Botswana' 'Brazil' 'British WestIndies'
'Bulgaria' 'Burundi' 'Cameroon' 'Canada' 'Chile' 'China' 'Colombia'
'Costa Rica' 'Ivory Coast' 'Croatia' 'Cuba' 'Cyprus' 'Czech Republic'
'Czechoslovakia' 'Denmark' 'Djibouti' 'Dominican Republic' 'Ecuador'
'Egypt' 'Eritrea' 'Estonia' 'Ethiopia' 'Fiji' 'Finland' 'France' 'Gabon'
'Georgia' 'Germany' 'UnitedTeamofGermany' 'East Germany' 'West Germany'
'Ghana' 'Great Britain' 'Greece' 'Grenada' 'Guatemala' 'Guyana' 'Haiti'
'Hong Kong' 'Hungary' 'Iceland' 'India' 'Indonesia' 'Iran' 'Iraq'
'Ireland' 'Israel' 'Italy' 'Jamaica' 'Japan' 'Jordan' 'Kazakhstan'
'Kenya' 'Kosovo' 'North Korea' 'South Korea' 'Kuwait' 'Kyrgyzstan'
'Latvia' 'Lebanon' 'Liechtenstein' 'Lithuania' 'Luxembourg' 'Malaysia'
'Mauritius' 'Mexico' 'Moldova' 'Mongolia' 'Montenegro' 'Morocco'
'Mozambique' 'Namibia' 'Netherlands' 'Netherlands Antilles' 'New Zealand'
'Niger' 'Nigeria' 'North Macedonia' 'Norway' 'Pakistan' 'Panama'
'Paraguay' 'Peru' 'Philippines' 'Poland' 'Portugal' 'Puerto Rico' 'Qatar'
'Romania' 'Russia' 'Russian Empire' 'Soviet Union' 'Unified Team'
'Russia' 'Saudi Arabia' 'Samoa' 'Senegal' 'Serbia' 'SerbiaandMontenegro'
'Singapore' 'Slovakia' 'Slovenia' 'South Africa' 'Spain' 'Sri Lanka'
'Sudan' 'Suriname' 'Sweden' 'Switzerland' 'Syria' 'Chinese Taipei'
'Tajikistan' 'Tanzania' 'Thailand' 'Togo' 'Tonga' 'TrinidadandTobago'
'Tunisia' 'Turkey' 'Uganda' 'Ukraine' 'UnitedArabEmirates'

40
'United States' 'Uruguay' 'Uzbekistan' 'Venezuela' 'Vietnam'
'Virgin Islands' 'Yugoslavia' 'Zambia' 'Zimbabwe']
Enter name of a Country / Countries inthe form of list like - ['India']: ['India']
Total Gold, Silver and Bronze Won by a Country/Countries :
Country Tgoldmedal Tsilvermedal Tbronzemedal
59 India 9 7 12
---------x-------------------x------------------x------------------x
Enter your choice : 11
---------x-------------------x------------------x------------------x

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
OLYMPICS GAMES ANALYSIS SYSTEM
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
1- Data Visualisation
2- Data Analysis
3- Read CSV/EXCEL File
4- Import / Export from/to MySQL
5- Data Manipulation
6- Exit
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
Enter your choice: 3
1) Read CSV file and display DataFrame

2) Read Excel File and Display Dataframe

3) Press 3 to go back to main menu


Enter your choice:1
Country SummerTimesPart WinterTimesPart TotalTimesPart \
0 Afghanistan 14 0 14
1 Algeria 13 3 16
2 Argentina 24 19 43
3 Armenia 6 7 13

41
4 Australasia 2 0 2
.. ... ... ... ...
144 Vietnam 15 0 15
145 Virgin Islands 12 7 19
146 Yugoslavia 18 16 34
147 Zambia 13 0 13
148 Zimbabwe 13 0 1

Tbronzemedal Tsilvermedal Tgoldmedal TotalMedal SummerTotal \


0 2 0 0 2 2
1 8 4 5 17 17
2 28 25 21 74 74
3 6 6 2 14 14
4 5 4 3 12 12
.. ... ... ... ... ...
144 1 3 1 5 5
145 0 1 0 1 1
146 32 34 28 94 90
147 1 1 0 2 2
148 4 3 8 15 1

WinterTotal
0 0
1 0
2 0
3 0
4 0
.. ...
144 0
145 0
146 4
147 0
148 14

[149 rows x 10 columns]


Done!
Enter your choice:2

42
Enter filename with PATH and EXTENSION(.xls/.xlsx) :C:\\Users\Dr. Jena\Desktop\IP
Project\exceldata.xlsx
Country SummerTimesPart WinterTimesPart TotalTimesPart \
0 Afghanistan 14 0 14
1 Algeria 13 3 16
2 Argentina 24 19 43
3 Armenia 6 7 13
4 Australasia 2 0 2
.. ... ... ... ...
144 Vietnam 15 0 15
145 Virgin Islands 12 7 19
146 Yugoslavia 18 16 34
147 Zambia 13 0 13
148 Zimbabwe 13 0 1
Tbronzemedal Tsilvermedal Tgoldmedal TotalMedal SummerTotal \
0 2 0 0 2 2
1 8 4 5 17 17
2 28 25 21 74 74
3 6 6 2 14 14
4 5 4 3 12 12
.. ... ... ... ... ...
144 1 3 1 5 5
145 0 1 0 1 1
146 32 34 28 94 90
147 1 1 0 2 2
148 4 3 8 15 1
WinterTotal
0 0
1 0
2 0
3 0
4 0
.. ...
144 0
145 0
146 4
147 0

43
148 14
[149 rows x 10 columns]
Done!

44
45
46
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
OLYMPICS GAMES ANALYSIS SYSTEM
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
1- Data Visualisation
2- Data Analysis
3- Read CSV/EXCEL File
4- Import / Export from/to MySQL
5- Data Manipulation
6- Exit
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Enter your choice: 5
DATA MANIPULATION

~~~~~~~~~~~~~~~~~~
1) Inserting a Row
2) Deleting a Row
3) Inserting a Column
4) Deleting a Column
5) Renaming a Column
6) Exit to main menu
Enter your choice :1
Enter the input in following format:
Index(['Country', 'SummerTimesPart','WinterTimesPart','TotalTimesPart','Tbronzemedal',
'Tsilvermedal', 'Tgoldmedal', 'TotalMedal','SummerTotal', 'WinterTotal'], dtype='object')
Enter the row values in list :['Albania',25,23,12,34,22,45,67,52,294]
Country SummerTimesPart WinterTimesPart TotalTimesPart
0 Albania 25 23 12
1 Afghanistan 14 0 14
2 Algeria 13 3 16
3 Argentina 24 19 43
4 Armenia 6 7 13
.. ... ... ... ...
145 Vietnam 15 0 15
146 Virgin Islands 12 7 19
147 Yugoslavia 18 16 34

47
148 Zambia 13 0 13
149 Zimbabwe 13 0 1

Tbronzemedal Tsilvermedal Tgoldmedal TotalMedal SummerTotal \


0 34 22 45 67 52
1 2 0 0 2 2
2 8 4 5 17 17
3 28 25 21 74 74
4 6 6 2 14 14
.. ... ... ... ... ...
145 1 3 1 5 5
146 0 1 0 1 1
147 32 34 28 94 90
148 1 1 0 2 2
149 4 3 8 15 1

WinterTotal
0 294
1 0
2 0
3 0
4 0
.. ...
145 0
146 0
147 4
148 0
149 14

[150 rows x 10 columns]


Row Added Successfully!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter your choice :2
Enter the row's index you want to be deleted :3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dataframe after row index no. 3 is deleted -->
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

48
Country SummerTimesPart WinterTimesPart TotalTimesPart \
0 Albania 25 23 12
1 Afghanistan 14 0 14
2 Algeria 13 3 16
4 Armenia 6 7 13
5 Australasia 2 0 2
.. ... ... ... ...
145 Vietnam 15 0 15
146 Virgin Islands 12 7 19
147 Yugoslavia 18 16 34
148 Zambia 13 0 13
149 Zimbabwe 13 0 1

Tbronzemedal Tsilvermedal Tgoldmedal TotalMedal SummerTotal \


0 34 22 45 67 52
1 2 0 0 2 2
2 8 4 5 17 17
4 6 6 2 14 14
5 5 4 3 12 12
.. ... ... ... ... ...
145 1 3 1 5 5
146 0 1 0 1 1
147 32 34 28 94 90
148 1 1 0 2 2
149 4 3 8 15 1

WinterTotal
0 294
1 0
2 0
4 0
5 0
.. ...
145 0
146 0
147 4
148 0

49
149 14

[149 rows x 10 columns]


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter your choice :3
Enter tthe column name :Gender
Enter the column index no.
Where You Want to input the Column :1
Country Gender SummerTimesPart WinterTimesPart TotalTimesPart
Tbronzemedal Tsilvermedal Tgoldmedal TotalMedal SummerTotal WinterTotal
0 Albania Nan 25 23 12 34 22 45 67
52 294
1 Afghanistan Nan 14 0 14 2 0 0 2
2 0
2 Algeria Nan 13 3 16 8 4 5 17
17 0
3 Argentina Nan 24 19 43 28 25 21 74
74 0
4 Armenia Nan 6 7 13 6 6 2 14
14 0
.. ... ... ... ... ... ... ... ... ... ... ...
145 Vietnam Nan 15 0 15 1 3 1 5
5 0
146 Virgin Islands Nan 12 7 19 0 1 0 1
1 0
147 Yugoslavia Nan 18 16 34 32 34 28
94 90 4
148 Zambia Nan 13 0 13 1 1 0 2
2 0
149 Zimbabwe Nan 13 0 1 4 3 8 15
1 14

[150 rows x 11 columns]


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter your choice :4
DataFrame before deleting the column

50
Country Gender SummerTimesPart WinterTimesPart TotalTimesPart
Tbronzemedal Tsilvermedal Tgoldmedal TotalMedal SummerTotal WinterTotal
0 Albania Nan 25 23 12 34 22 45 67
52 294
1 Afghanistan Nan 14 0 14 2 0 0 2
2 0
2 Algeria Nan 13 3 16 8 4 5 17
17 0
3 Argentina Nan 24 19 43 28 25 21 74
74 0
4 Armenia Nan 6 7 13 6 6 2 14
14 0
.. ... ... ... ... ... ... ... ... ... ... ...
145 Vietnam Nan 15 0 15 1 3 1 5
5 0
146 Virgin Islands Nan 12 7 19 0 1 0 1
1 0
147 Yugoslavia Nan 18 16 34 32 34 28
94 90 4
148 Zambia Nan 13 0 13 1 1 0 2
2 0
149 Zimbabwe Nan 13 0 1 4 3 8 15
1 14

[150 rows x 11 columns]


Column name you want to delete : Gender
DataFrame after deleting the column Gender :
Country SummerTimesPart WinterTimesPart TotalTimesPart Tbronzemedal
Tsilvermedal Tgoldmedal TotalMedal SummerTotal WinterTotal
0 Albania 25 23 12 34 22 45 67
52 294
1 Afghanistan 14 0 14 2 0 0 2 2
0
2 Algeria 13 3 16 8 4 5 17 17
0
3 Argentina 24 19 43 28 25 21 74
74 0

51
4 Armenia 6 7 13 6 6 2 14 14
0
.. ... ... ... ... ... ... ... ... ... ...
145 Vietnam 15 0 15 1 3 1 5 5
0
146 Virgin Islands 12 7 19 0 1 0 1 1
0
147 Yugoslavia 18 16 34 32 34 28 94
90 4
148 Zambia 13 0 13 1 1 0 2 2
0
149 Zimbabwe 13 0 1 4 3 8 15
1 14

[150 rows x 10 columns]


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter your choice :5
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DataFrame before changing the column name/s
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Country SummerTimesPart WinterTimesPart TotalTimesPart Tbronzemedal
Tsilvermedal Tgoldmedal TotalMedal SummerTotal WinterTotal
0 Albania 25 23 12 34 22 45 67
52 294
1 Afghanistan 14 0 14 2 0 0 2 2
0
2 Algeria 13 3 16 8 4 5 17 17
0
3 Argentina 24 19 43 28 25 21 74
74 0
4 Armenia 6 7 13 6 6 2 14 14
0
.. ... ... ... ... ... ... ... ... ... ...
145 Vietnam 15 0 15 1 3 1 5 5
0
146 Virgin Islands 12 7 19 0 1 0 1 1
0

52
147 Yugoslavia 18 16 34 32 34 28 94
90 4
148 Zambia 13 0 13 1 1 0 2 2
0
149 Zimbabwe 13 0 1 4 3 8 15
1 14

[150 rows x 10 columns]


Enter the column name you want to rename :Country
Enter the new column name :CountryName
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dataframe after changing the column name/s
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CountryName SummerTimesPart WinterTimesPart TotalTimesPart Tbronzemedal
Tsilvermedal Tgoldmedal TotalMedal SummerTotal WinterTotal
0 Albania 25 23 12 34 22 45 67
52 294
1 Afghanistan 14 0 14 2 0 0 2 2
0
2 Algeria 13 3 16 8 4 5 17 17
0
3 Argentina 24 19 43 28 25 21 74
74 0
4 Armenia 6 7 13 6 6 2 14 14
0
145 Vietnam 15 0 15 1 3 1 5 5
0
146 Virgin Islands 12 7 19 0 1 0 1 1
0
147 Yugoslavia 18 16 34 32 34 28 94
90 4
148 Zambia 13 0 13 1 1 0 2 2
0
149 Zimbabwe 13 0 1 4 3 8 15
[150 rows x 10 columns]
Enter your choice :6
Returning to main menu......Done!!

53
<BIBLIOGRAPHY>
 Book Used: Sultan Chand Informatics Practices
Python Class 12
 www.cbse.nic.in
 www.data.gov.in
 www.python4csip.com
 www.stackoverflow.com
 www.github.com
 www.w3schools.com
 www.sultanchand.com/ws/ipp12
<Prepared By: Arnab Jena>
<THANK YOU>

You might also like