Computer Project
Computer Project
windows 7 ultimate
System hardware:
Manufacturer: intel
Processor: Intel® Core™2 duo CPU E7500 @ 2.93Ghz
2.93Ghz
Installed memory(RAM): 4.00 GB
System type: 64-bit Operating System
Monitor: acer
Library/ Purpose
Module
numpy Provides support for numerical
computations. (Not used directly in the
code, but imported.)
pandas For data manipulation and analysis, e.g.,
reading the dataset, filtering data, and
summary stats.
2. Visualization Libraries
Library/Module Purpose
matplotlib.pypl Used to create basic visualizations,
ot such as setting plot dimensions and
displaying the plots.
seaborn A modern visualization library that
makes creating attractive and
informative statistical graphics easier.
Code-Specific Usage of Libraries
pandas
Used for:
matplotlib.pyplot
Used for:
seaborn
Used for:
Functions used:
1. Functions from pandas
Function Purpose Usage in Code
Data Analysis:
Functions from pandas are used to load, filter, and analyze the dataset
(e.g., read_csv(), iloc[], value_counts()).
Visualization:
matplotlib and seaborn functions are used to create visual
representations of the data (e.g., countplot(), barplot()).
Console Output:
Python's print() function is used to display text-based results directly in
the terminal.
Source code:
importnumpy as np # numerical computing
plt.rcParams['figure.figsize'] = (14, 8)
sns.set_style("darkgrid")
df = pd.read_csv("E:\ipl1.csv")
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
print(df.info())
print()
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
print()
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
print(df['season'].unique())
print()
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
print(df.iloc[df['win_by_runs'].idxmax()])
print()
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
print(df.iloc[df['win_by_wickets'].idxmax()]['winner'])
print()
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
print()
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
print(df.iloc[df[df['win_by_wickets'].ge(1)].win_by_wickets.idxmin()])
print()
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
sns.countplot(x='season', data=df)
plt.show()
print()
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
data = df.winner.value_counts()
sns.barplot(y = data.index, x = data, orient='h')
print()
print('---------------------------------------------------------------------------')
print('---------------------------------------------------------------------------')
print('The Players who got maximum times Man of the Match are:::')
top_players = df.player_of_match.value_counts()[:10]
fig, ax = plt.subplots()
ax.set_ylim([0,20])
ax.set_ylabel("Count")
#top_players.plot.bar()
#palette="Blues");
plt.show()
OUTPUT:
---------------------------------------------------------------------------
---------------------------------------------------------------------------
<class 'pandas.core.frame.DataFrame'>
None
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------------------------------------------------------------------------
[2017 2008 2009 2010 2011 2012 2013 2014 2015 2016 2018]
---------------------------------------------------------------------------
---------------------------------------------------------------------------
id 44
season 2017
city Delhi
date 5/6/2017
toss_decision field
result normal
dl_applied 0
win_by_runs 146
win_by_wickets 0
umpire2 CK Nandan
umpire3NaN
Name: 43, dtype: object
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Mumbai Indians
---------------------------------------------------------------------------
---------------------------------------------------------------------------
id 560
season 2015
city Kolkata
date 5/9/2015
toss_decision bat
result normal
dl_applied 0
win_by_runs 0
win_by_wickets 1
player_of_match AD Russell
umpire1 AK Chaudhary
umpire2 HDPK Dharmasena
umpire3NaN
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------------------------------------------------------------------------
The Players who got maximum times Man of the Match are:::
How the Code Works:
1. Loads the IPL Dataset:
python
Copy code
df = pd.read_csv(r"E:\ipl1.csv")
2. Data Inspection:
o The info() function gives a summary of the dataset.
o df['id'].max() is used to determine the total matches
(assuming id is a unique identifier for matches).
4. Seasonal Trends:
o Creates a count plot of matches per season with
sns.countplot().
4. Seasonal Analysis:
o Season with Most Matches:
Uses a count plot to show how many matches occurred in
each season, making it easy to spot the busiest IPL season.
Match Trends: Total matches played and which season was the
busiest.
Team Performance: Which teams have been the most
successful and dominant in the IPL.
Player Excellence: Players who consistently delivered match-
winning performances.
Winning Margins: Insights into the biggest and closest wins in
IPL history.
Bibliography:
https://engineersplanet.com/python-projects-class-
xi-xii/
https://python4csip.com/computer-science-xii.php
https://cbseacademic.nic.in/web_material/doc/cs/
2_Computer_Science_Python_ClassXII.pdf
COMPUTER SCIENCE with python by Sumita Arora