CHINMAYA VIDYALAYA TATTAMANGALAM
ACADEMIC YEAR:2024-25
INVESTIGATORY PROJECT REPORT
TOPIC:ACCIDENT ANALYSIS SYSTEM
ROLL NO :
NAME :
CLASS :
SUBJECT :INFORMATICS PRACTICES
SUB CODE :065
PROJECT GUIDE : Ms DHANYA H
1
CHINMAYA VIDYALAYA TATTAMANGALAM
CERTIFICATE
This is to certify that Roll No: has
successfully completed the investigatory project work entitled
ACCIDENT ANALYSIS SYSTEM in the subject Informatics
Practices (065) for the academic year 2024-25, down in the
regulations of CBSE for the purpose of Practical Examination in
Class XII to be held in Chinmaya Vidyalaya Tattamangalam.
Signature of INTERNAL EXAMINAR
Signature of Principal
Signature of EXTERNAL EXAMINAR
2
ACKNOWLEDGEMENT
I would specially thank [Link] H ,our Informatics
Practices teacher for providing her valuable guidance,
support, suggestions and comments throughout the course of
project.
I would also like to express my sincere gratitude to our
Principal Ms. DEEPA MENON for providing an
opportunity to work of investigatory project on the topic
ACCIDENT ANALYSIS SYSTEM. The completion of the
project would not have been possible without their help and
insights.
I would like to extend my appreciation to all my group
members Jayaram U, Adarsh M, Anshif S who contributed
their cooperation and inputs to the success of this project.
Signature:
Name:
3
TABLE OF CONTENTS
SER DESCRIPTION PAGE
NO
01 INTRODUCTION 5
02 ABOUT PYTHON PANDAS 6
03 ABOUT CSV FILES 7
04 OBJECTIVE OF PROJECT-DATA ANALYSIS 8
05 BASIC MODULES 9
06 CODES 10
07 OUTPUTS 17
08 DATA VISUALISATION 22
09 CONCLUSION 28
10 BIBLIOGRAPHY 29
4
INTRODUCION
This project is designed to offer user convenient access to
demographic information anytime, anywhere.
Developed with optimal functionality in mind, this project
facilitates various essential operations, including data
insertion, updates, detailed viewing, and deletion. The
system’s architecture has been carefully crafted to ensure
seamless functionality. Our progress has been guided by
expertise of our instructor, and data transmission is
facilited through meticulously crafted code.
5
ABOUT PYTHON PANDAS
Python is a high-level, general-purpose programming language. Its
design philosophy emphasizes code readability with the use of
significant indentation. Created by Guido Van Rossam and first
released in 1991, Python is a multi-paradigm programming language.
Object-oriented programming and structured programming are fully
supported, and many of their features support functional programming
and aspect-oriented programming.
Python is dynamically typed and garbage-collected. It supports
multiple programming paradigms, including structured (particularly
procedural), object-oriented and functional programming. It is often
described as a "batteries included" language due to its comprehensive
standard library.
Pandas is a software library written for the Python programming
language for data manipulation and analysis. In particular, it offers
data structures and operations for manipulating numerical tables and
time series. It is free software released under the three-clause BSD
license. The name is derived from the term "panel data", an
econometrics term for data sets that include observations over
multiple time periods for the same individuals, as well as a play on
the phrase "Python data analysis".
6
ABOUT CSV FILES
Comma-separated values (CSV) is a text file format that uses commas
to separate values, and newlines to separate records. A CSV file stores
tabular data (numbers and text) in plain text, where each line of the
file typically represents one data record. Each record consists of the
same number of fields, and these are separated by commas in the CSV
file.
CSV formats are best used to represent sets or sequences of records in
which each record has an identical list of fields. This corresponds to a
single relation in a relational database, or to data (though not
calculations) in a typical spreadsheet.
A CSV file is a spreadsheet format, so it can be opened by spreadsheet
applications like Microsoft Excel and Google Spreadsheets. Since
CSV files are used to exchange large volumes of data, database
programs, analytical software, and applications that can store massive
amounts of information usually support the CSV.
CSV is a common data exchange format that is widely supported by
consumer, business, and scientific applications. Among its most
common uses is moving tabular databetween programs that natively
operate on incompatible (often proprietary or undocumented) formats
7
OBJECTIVE OF THE PROJECT
The main goal of our system is to analyse Accident data effectively.
This Accident analysis system offers a comprehensive platform
accessible through an online interface, catering to users with internet
connectivity. The system provides in depth demographic information,
offering insights into various metrics and analyses. Our platform
stands as an exceptional resource for those seeking detailed accident
data without the constraints of time limitations. Users can access
detailed demographic insights at any hour, enabling comprehension
analysis and decision making.
8
BASIC MODULES
Create(): It is a function used to enter the data containing details
Add():It is a function used to add details after the details has been
entered once.
Display():It is a function which is used to display all the records
entered into the system.
Del()-It is a function used to delete details of specified names.
Search():It is a function used to search the details from the data
Update():It is a function which is used to modify specific information
from the data
Table without header:Reading in a CSV file into a Pandas Data
Frame will by default, set the forts row of the .csv file as the headers
in the table. However , if the .csv file does not have any pre-existing
headers, Pandas can skip this setup and instead start reading the first
row of the .csv as data entries into the data frame.
Head():returns the first n rows
Tail()-returns the last n rows
Sorting the values in ascending order. It is used to sortthe data in
ascending order on the basic of a specified column.
Sorting the values in Descending order- It is used to sort the data in
descending order on the basis of a specified column.
9
CODES
10
import pandas as pd
import [Link] as plt
#interface
while True:
print("/n")
print("\t\t\t MAIN MENU")
print("\n\t\t ACCIDENT CASES\n\t\t\n")
print("[Link]/Read CSV [[Link]]")
print("[Link] Data")
print("[Link] Data")
print("[Link] Data")
print("[Link] analysis[ACCIDENT CASES]")
print("[Link] analysis [NATIONAL HIGHWAYS CASES")
print("[Link] analysis NATIONAL HIGHWAYS CASES INJUIRED")
print("[Link]")
print("\n")
#user input
ch=int(input("enter your choice:"))
#process
#[Link]/read CSV[[Link]]
if ch==1:
df=pd.read_csv('[Link]')
11
print(df)
print("\n")
#[Link] Data
elif ch==2:
S_no=int(input("enter [Link].:"))
state=input("Enter State/UT:")
pp_22=int(input("Enter ACCIDENT CASES:"))
PGR_22=int(input("Enter HIGHWAYS CASES AND INJUIRED"))
PD_22=int(input("Enter ACCIDENT CASES"))
dic={'[Link]':[S_no],'State UT':[state],'National Highways - Cases
':[pp_22]}
df=[Link](dic)
df.to_csv('[Link]',mode='a',index=False,header=False)
print('data appended successfully')
#[Link] Data
elif ch==3:
df=pd.read_csv('[Link]')
S_no=int(input('enter [Link]. to modify:'))
ind=df[df['S_no']==S_no].[Link]()
print('\n')
while True:
#state
state_i=input("Do you want to modify State /UT[y/n]")
12
if state_i=='y':
state=input('enter new state/ut name:')
[Link][ind,'state/UT']=state
df.to_csv('',index=False)
print('done')
print('\n')
elif state_i=='n':
print('No Modification performed')
print('\n')
else:
print('INVALID INPUT')
print('\n')
pp_22_i=input('do you want to modify accident cases [y/n]:')
#PP_22
if pp_22_i=='y':
pp_22=input('enter new value :')
[Link][ind,'National Highways - Cases ']=pp_22
df.to_csv('[Link]',index=False)
print('Done')
print('\n')
elif pp_22_i=='n':
print("no modification performed")
print('\n')
13
else:
print("INVALID INPUT")
print("\n")
PGR_22_i=input('do you want to modify values [y/n]:')
#PGR
if PGR_22_i=='y':
PGR_22=input('enter new accident rate :')
[Link][ind,'National Highways - Cases']=PGR_22
df.to_csv('[Link]',index=False)
print('done')
print('\n')
elif PGR_22_i=='n':
print('no modification performed')
print('\n')
elif PGR_22_i!='y' or 'n':
print('INVALID INPUT')
print('\n')
ex_i=input('exit modifing menu?[y/n]')
#ex_i
if ex_i=='y':
print("done")
break
14
elif ex_i=='n':
print("done")
else:
print("INVALID INPUT")
print('\n')
#[Link] data
elif ch==4:
sn=int(input('enter [Link] to delete:'))
df=pd.read_csv('[Link]')
ind=df[df['[Link]']==sn].[Link]()
[Link](ind,axis=0,inplace=True)
df.to_csv("[Link]")
print('deleted successfully')
#5 view analysis
elif ch==5:
df=pd.read_csv("[Link]",usecols=['National Highways -
Cases'])
[Link](kind='line',color=['red'])
[Link]('Accident analysis')
[Link]('[Link]')
[Link]('Accident cases')
[Link]()
#6 view analysis [electricity production]
elif ch==6:
15
df=pd.read_csv('[Link]',usecols=['National Highways -
Cases'])
[Link](kind='bar',color=['red'])
[Link]('[Link]')
[Link]('National Highways - Cases')
[Link]()
#7 view analysis [ Accident data analysis]
elif ch==7:
df=pd.read_csv('[Link]')
[Link](figsize=(10,6))
[Link](df['National Highways - Cases'],label=df['[Link]'])
[Link]()
#8 exit
elif ch==8:
CH8=input('are you sure [y/n]')
if CH8=='y':
print('done')
break
elif CH8=='n':
print('done')
else:
print('INVALID')
else:
print('INVALID')
16
OUTPUT
17
18
19
20
21
DATA
VISUALISATION
Data visualization is a crucial aspect of data analysis, enabling data
scientists and analysts to present complex data in a more
understandable and insightful manner. One of the most popular
libraries for data visualization in Python is Matplotlib. In this article,
we will provide a comprehensive guide to using Matplotlib for
creating various types of plots and customizing them to fit specific
needs and how to visualize data with the help of the Matplotlib library
of Python.
Matplotlib provides a module called pyplot, which offers a
MATLAB-like interface for creating plots and charts. It simplifies the
process of generating various types of visualizations by offering a
collection of functions that handle common plotting tasks
22
Line chart-
Line chart is one of the basic plots and can be created using
the plot() function. It is used to represent a relationship
between two data X and Y on a different axis.
Bar chart-
A bar chart is a graph that represents the category of data with
rectangular bars with lengths and heights that is proportional
to the values which they represent. The bar plots can be
plotted horizontally or vertically. A bar chart describes the
comparisons between the discrete categories. It can be created
using the bar() method.
Histogram-
A histogram is basically used to represent data provided in a
form of some groups. It is a type of bar plot where the X-axis
represents the bin ranges while the Y-axis gives information
about frequency. The hist() function is used to compute and
create histogram of x.
23
OUTPUT
24
25
26
27
CONCLUSION
The Successful development of this system underscores its efficiency
and reliability. Our project serves the fundamental purpose of offering
users seamless access to comprehensive Accident analysis tools.
aimed at providing users with anytime, anywhere access to
demographic insights, this system minimizes the effort required for
Accident data analysis. Just as movie lovers benefit from the
convenience of online ticket booking, out system ensures effortless
access to crucial accident information, ultimately saving time and
effort for users seeking comprehensive demographic insights.
28
BIBILOGRAPHY
Informatics practices for class xii
- by SUMITA ARORA/PREETO ARORA
[Link]
[Link]
[Link]
29