Ip Project
Ip Project
PROJECT REPORT ON
MOTORCYCLE SALES ANALYSIS
Project prepared by:
Name : Eklavya Mahawar and Dhruva Heda
Class : XII Commerce A
Roll Number : 11636973 and 11636971
Session : 2024-2025
Submitted To : Mr. Devendra Bagla
1
Table of Contents
Acknowledgment
Certificate
Library Used
Reason for Selection
Data used from CSV file
Code
Bibliography
2
Acknowledgement
We would like to express our special
thanks and gratitude to our Informatics
Practices teacher Mr. Devendra Bagla for
his able guidance and support in
completing our project. We would also like
to extend our gratitude to our Principal
Mr. Sanjay Khati for providing us with all
the facilities that were required for
completing the project.
3
Certificate
This is to certify that Eklavya Mahawar
and Dhruva Heda of Class XII commerce A,
Mayoor School, Ajmer has successfully
completed their project in Informatics
Practices for the SSE as prescribed by CBSE
in the year 2024-2025.
Date :
Signature of Signature of
Internal External
Examiner Examiner
4
Library Used
import matplotlib.pyplot
import pandas
import numpy
5
Reason for Selection
This project helped us to understand the concept of Python
Pandas and Matplotlib Library in a very simple and profound
manner.
The main aim of the project is to analyze the Motorcycle Sales
Data based on the sales in November 2020 & December 2020
and produces a summarised report with data visualization.
6
Data used from CSV file
7
Code
intro=''' -------------- T20 Top Scorer Ananlysis ----------------
main_menu='''\n\n
-------MAIN MENU----------
1. Cricketers Data Import To DataFrame or Export TO CSV File
2. Cricketers Data Anyalysis/Data Manipulation
3. Cricketers Data Visualization
4. Exit'''
8
7. Return to Main Menu'''
analysis_menu='''\n\n --------SEARCH/ADDITION/DELETION--------
1. Dispaly All Records
2. Search Records based on Selected Column
3. Search Records based on Innings
4. Search Records based on Matches
5. Search Records based on Team
6. Search Records based on Row Label/Number(loc[]/iloc[])
7. State Name of Players having Average more than 40
8. State Name of Players scoring maximum runs different innings played
9. Top Five Records
10. Last Five Records
11. Addition of a New Record to DataFrame
12. Deletion of Reocrds from DataFrame
13. Return to Main Menu'''
for i in intro:
print(i,end='')
while True:
print(main_menu)
ch=int(input('Enter your choice -> '))
if ch==1:
9
while True:
print(import_export_menu)
ch3=int(input('Enter your choice -> '))
if ch3==1:
df= pd.read_csv('D:\\Project\\data.csv')
pd.set_option('display.expand_frame_repr',False) #To display data in expanded form
pd.set_option('display.max_rows',1100) #To display all rows on screen
print('Content of data frame ')
print(df)
print()
elif ch3==2:
df.to_csv ("exported_data.csv", index=False, header=True)
print('\nData Written in [exported_data.csv] file.........\n\n')
elif ch3==3:
print('\n.........Back to Main menu........\n\n')
break
else:
print('\nWrong Choice\n')
elif ch==2:
while True:
print(analysis_menu)
ch1=int(input('Enter your choice -> '))
if ch1==1:
print(df)
print()
elif ch1==2:
print('\nList of Columns are [')
for x in df.columns:
print(x,end=', ')
print(' ]')
clist=[]
10
while True:
c=input('\nEnter column name -> ')
clist.append(c)
ch=input('Want to give more column name-> ')
if ch in 'nN':
break
print('Details of Selected columns data')
print(df[clist])
print()
elif ch1==3:
print('Subgroup of Innings ',df.Innings.unique())
n=int(input('\nEnter Innings '))
df1=df[df.Innings==n]
if df1.empty:
print('\n.......sorry no data for this group........')
else:
print(df1)
print()
elif ch1==4:
print('\nList of Matches Played ',df.Matches.unique())
st=int(input('\nEnter Matches -> '))
df1=df[df.Matches==st]
if df1.empty:
print('\nNo Record is available for -> ',st)
else:
print(df1)
print()
elif ch1==5:
print('List of Teams ',df.Team.unique())
y=input('\nEnter Team : ')
df1=df[df.Team==y]
11
if df1.empty:
print('\n.........Sorry No Record Exist.........\n')
else:
print(df1)
print()
elif ch1==6:
print('\nAvailable Record Numbers Range -> ',df.index)
n=eval(input('\nEnter Row numbers for which you want to display record -> '))
df1=df.iloc[n] # df.loc[n]
if df1.empty:
print('\n........Sorry Records not exist........\n')
else:
print(df1)
print()
elif ch1==7:
print('\nState Names of players having average more than 40 -> \n ')
df1=df.loc[df['Average']> 40, ['Player','Average']]
# OR df1=df[df['Average']>40]
if df1.empty:
print('\n.......Sorry such records exist......\n')
else:
print(df1)
print()
elif ch1==8:
g=df.groupby('Innings')
print('\nPlayer Name scoring maximum runs different innings played\n')
df1=g.max()
if df1.empty:
print('\n........Sorry Record Not Found..........\n')
else:
print(df1)
12
print()
elif ch1==9:
print('\nTop five records are ')
print(df.head())
print()
elif ch1==10:
print('\nLast five records are ')
print(df.tail())
print()
elif ch1==11:
no=int(input('Enter Number: '))
name=input("Enter Player Name : ")
match=int(input('Enter Number of Matches Palyed : '))
inn=int(input('Enter Number of Innings Played : '))
runs=int(input('Enter Runs Scored : '))
team=input('Enter Team Name : ')
avg=runs/inn
#L=[no,name,match,inn,runs,avg,team]
#n=int(input('\n\nEnter the index number for new record -> '))
#df.loc[n]=L # this command replace existing row, beneficial for update
df=df.append({'No':no,'Player':name,'Matches':match,'Innings':inn,'Runs':runs,'Average':avg,'Team'
:team}, ignore_index=True)
print('\n.........Record inserted...........\n')
elif ch1==12:
n=int(input('Enter the row index number for deletion -> '))
df.drop(n,inplace=True)
print('\n------------Record deleted---------------')
elif ch1==13:
print('\n.........Back to Main menu........\n\n')
break
else:
13
print('\nWrong Choice\n')
elif ch==3:
while True:
print(plot_menu)
ch2=int(input('\nEnter your choice -> '))
if ch2==1:
df.plot('Player','Runs')
plt.ylabel('Runs Scored',fontsize=12)
plt.xlabel('Player',fontsize=12)
plt.title('Runs scored by Players',fontsize=14)
plt.show()
elif ch2==2:
df.plot.bar('Player','Runs')
plt.ylabel('Runs Scored',fontsize=12)
plt.xlabel('Player',fontsize=12)
plt.title('Runs scored by Players',fontsize=14)
plt.subplots_adjust(bottom=0.35)
plt.show()
elif ch2==3:
print('List of Teams ',df.Team.unique())
t=input('\nEnter Team ')
df1=df[(df.Team==t)]
df1.plot('Player',['Runs'])
plt.ylabel('Runs Scored',fontsize=12)
plt.xlabel('Player',fontsize=12)
plt.title('Runs scored by Players',fontsize=14)
plt.show()
elif ch2==4:
x = np.arange(len(df))
plt.figure(figsize=(15,7))
plt.bar(x,df['Innings'],color='r',width=.25)
14
plt.bar(x+.2,df['Matches'],color='b',width=.25)
plt.ylabel('fghdfghfg',fontsize=12)
plt.xlabel('States',fontsize=12)
plt.title('hello',fontsize=14)
#plt.subplots_adjust(bottom=0.35) #Margin between X-axis and bottom of chart
window
plt.show()
elif ch2==5:
df.plot.bar('Player',['Matches','Innings','Runs'],stacked=True)
plt.ylabel('Count',fontsize=10)
plt.xlabel('Players',fontsize=10)
plt.xticks(range(0,len(df.Player)),df.Player,rotation='vertical')
plt.title('Stacked Bar Plot',fontsize=12)
plt.subplots_adjust(bottom=0.35)
plt.show()
elif ch2==6:
df.hist(['Matches','Innings','Runs'],bins=10)
plt.xticks(range(0,len(df.Player)),df.Player,rotation='horizontal')
plt.show()
elif ch2==7:
print('\n.........Back to Main menu........\n\n')
break
else:
print('\nWrong Choice\n')
else:
break
15
Bibliography
https://www.google.com/
https://en.wikipedia.org/wiki/Wikipedia
https://www.motorcyclesdata.com/
https://www.youtube.com/
Informatics practices by Sumita Arora
16