0% found this document useful (0 votes)
26 views22 pages

Ip Final Practical File

The document certifies that Malkit Singh, a student of class XII Science at Green Field Public School, has completed his practical work for the CBSE Informatics Practices examination under supervision. It includes sections on acknowledgments, an index of Python and MySQL programs, and various coding tasks related to data manipulation and visualization. The document serves as a practical file showcasing the student's work and understanding of informatics practices.

Uploaded by

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

Ip Final Practical File

The document certifies that Malkit Singh, a student of class XII Science at Green Field Public School, has completed his practical work for the CBSE Informatics Practices examination under supervision. It includes sections on acknowledgments, an index of Python and MySQL programs, and various coding tasks related to data manipulation and visualization. The document serves as a practical file showcasing the student's work and understanding of informatics practices.

Uploaded by

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

CERTIFICATE

This is to certify that Ms./Mr. Malkit singh roll


number 1223 student of class XII SCIENCE from
GREEN FIELD PUBLIC SCHOOL

has successfully completed his practical work for


academic session 2024-25 under my supervision and
guidance in partial fulfillment of CBSE Informatics
practices(065) practical examination.

External examiner Teacher in-charge Principal

1
INTRODUCTION

NAME : MALKIT SINGH

CLASS :XII Science

SUBJECT : Informatics Practices

SCHOOL : GREEN FIELD PUBLIC SCHOOL


(GZB).

SUBMITTEDTO : Mr. Deepak Sir

2
ACKNOWLEDGEMENT
I would like to thank my teacher Mr. Deepak
Sir
for giving me the opportunity to do this
practical file. This also helped me I doing
a lot of research and increased my
knowledge in difficult topics.

3
INDEX
PYTHONPROGRAMS
S r .No Questions Tr. Sign.
1. Createaseriesofthesenumbers:33,55,65,29,19,23.
2. Createaseriesof10numbersstartingwith41andwiththe increment
of 3.
3. Createaseriesof10numbersusingndarray.
4.
Createaseriesandprintthetop3andbottom3elementsusing the
head and tail functions.
5. Writecodetoshowalattributesofseries.UseseriesinQ1.
6. UseSeriescreatedinQ2adfindoutputoffollowing commands:-
s[::2],s[1:3]&s[[1,3,4]].

7
Writecodetochangevalue29and23fromseries Q1.

8. Write code to sort series in descending order-(UseQ3).


9. Create a data frame countries using a dictionary which stored 5
country name ,capital sand population soft he country .Index will
Be years.
10. Write a program to show all attribute so f data frame created in
Q9.
11. Createadataframeplayerstostore10playerswiththeirhighest and
lowest score no _of matches columns. Player names are indices of
data frame. Perform following questions:-
a) Show data of any two players using loc function.
b) Show any two columns.
c) Show data of two rows and two columns using loc function.
d) Make use of rename command to change column
name no _of _matches to Matches _played.
e) Drop row of last player.
MakemultiplebargraphfordataframecreatedinQ11.
13. Create line graph for temp .seven days of week.
12.

14.
Create histogram to show sales of one month data.

15. Create c s v file from data frame players .Make sure null values are

4
Handled properly.
16. Create c s v file in excel .Open c s v in data frame. Make use of n rows
command.

MYSQLPROGRAMS
1. Create database DATA
Create the following table product
Table :Products
P code P name Qty Price Company
P1001 I pad 15000 Apple
P1002 LEDTV 85000 Sony
P1003 DSLR 25000 Philips
CAMERA
P1004 I Phone 95000 Apple
P1005 LEDTV 45000 MI
P1006 Bluetooth 20000 Ahuja
Speaker

2. Show table structure.


3. Show records of table products.
4. ShowproductsofpcodeP1001and P1005.
5. Show data of products starting with I .
6. Show data of all products whose quantity>50and price>30000.
7. Show sum of price of all products.
8. Show product names in upper case and also length of all products.

9.
Show product name and qty joined with space under heading “Product and Qty”.

10. Displayfirst2andlast2lettersfromPname.
11. Write queries using e mp l table:
Show total employees working in each department.
Show avg salary of each job
Show min salary of each department where minimum employees are>3.
12. Write queries using empl and dept table:
Show employees names and location of job.
Show avg salary of employees working in sales department.
Show e name ,salary ,d name ,and location and all
13. employees. Display current date and time.
14. Display day of week, day of year and day name for current date.
15.
Write query to drop the table product.

5
PYTHONPROGRASM
1) Createaseriesofthesenumbers:33,55,65,29,19,23.
CODE:-
import pandas as pd
s1=pd.Series([33,55,65,29,19,23])
print(s1)
OUTPUT:-

2) Createaseriesof10numbersstartingwith41andwiththeincrementof3.
CODE:-
Import pandas aspd
s n = 41
I m=3
a= []
For Iin range(10):
a. append(sn)
sn = sn+im
m=pd.Series(a)
print(m)
OUTPUT:-

6
3) Createaseriesof10numbersusing ndarray.

CODE:-
Import pandas aspd
import numpy as np
s=pd. Series( np. Arrange (1,11))
print(s)
OUTPUT:-

4) Createaseriesandprintthetop3andbottom3elementsusingthehead and
tail functions.
CODE:-
Import pandas as pd
s=[10,20,30,40,50,60,70,80,90,100]
s1 = pd. Series(s)
print(s1.head(3))
print(s1.tail(3))
OUTPUT:-

7
5) WriteCODEtoshowallattributesofseries.UseseriescreatedinQ1.

CODE:-
import pandas as pd
S5=pd.Series([33,55,65,29,19,23])
print(S5[:])
OUTPUT:-

6) Use Series createdinQ2and find OUTPUT of following commands:-s[: :2]


s[1:3] s[[1,3,4]].

CODE:-
print(m[::2])
print(m[1:3])
print(m[[1,3,4]])
OUTPUT:-

8
7)
WriteCODEtochangevalue29and23fromseriesofQ1.
CODE:-
import pandas as pd
s1=pd.Series([33,55,65,29,19,23])
s1[3]=30
s1[5]=28
print(s1)
OUTPUT:-

8) Write CODE to sort series in descending order-(Use Q3).


CODE:-
Import pandas aspd
import numpy asnp
s=pd. Series(np. arange (1, 11))
print(s)
s=s.sort_values(ascending=False)
print(s)
OUTPUT:-

9
9) Create a data frame countries using a dictionary which stored 5
country name, capital sand populations of the country. Index will
be years.

CODE:-
Import pandas as pd
countries=
pd.DataFrame(({
'Country':['USA','Canada','UK','Germany','France'],
'Capital': ['Washington D.C.', 'Ottawa', 'London', 'Berlin', 'Paris'],
'Population': [331002651,37742154, 67886011, 83783942, 65273511]
}),['2020','2021','2022','2023','2024'])
print(cou
ntries)
OUTPUT-

10) WriteprogramtoshowallattributesofdataframecreatedinQ9.
CODE:-
Import pandas as pd
import numpy as np
data={'Country':['UnitedStates','France','Brazil','Japan','Australia'],
'Capital':['Washington,D.C.','Paris','Brasília','Tokyo','Canberra'],
'Population': [1000000, 2000000, 1500000, 2500000, 1800000]}

S10=pd. Data Frame(data, index=[2020,2021,2022,2023,2024]) print(S10[:])

OUTPUT-

10
11)
Create data frame players to store 10 players with their highest and lowest
score no_ of matches columns. Player names are indices of data frame.
perform following questions:-
a) Show data of any two players using loc function.
b) Show any two columns.
c) Show data of two rows and two columns using loc function.
d) Make use of rename command to change column name no_ of_ matches to
Matches_ played.
e) Drop row of last
player.
CODE:-
import pandas as pd
players=pd.Data Frame({
‘Player': ['Player1', 'Player2', 'Player3', 'Player4', 'Player5', 'Player6', 'Player7','Player8','Player9',
'Player10'],
'Highest_ Score':[98,89,95,87,99,92,96,90,88,94],
'Lowest_ Score':[45,55,50,42,48,51,46,56,49,47],
'Matches_ played':[30,35,32,33,31,29,34,30,36,37]})
players. set_ index('Player' ,in place=True)
print('a)Show data of any two players using loc function')
print(players.loc[['Player1','Player3']])
print('b)Show any two columns')
print(players[['Highest_Score',' Lowest_ Score']])
print('c) Show data of two rows and two columns using loc function')
print(players.loc[['Player2', 'Player5'], ['Highest_ Score', 'Lowest_ Score']])
print('d) Make use of rename command to change column name no_ of_ matches to
Matches_ played')
players. rename(columns={'Matches_ played': 'no_ of _matches'}, in place=True)
print('Drop the row of the last player')
players.drop('Player10', in place=True)
print('Display the updated DataFrame')
print(players)
OUTPUT:-

11
12) MakemultiplebargraphfordataframecreatedinQ.11

CODE:-
Import pandas as pd
Import matplotlib.Pyplot asplt
players=pd.DataFrame({'Playe
r': ['Player1', 'Player2',
'Player3', 'Player4', 'Player5',
'Player6', 'Player7', 'Player8',
'Player9', 'Player10'],
'Highest_ Score':[98,89,95,87,99,92,96,90,88,94],
'Lowest_ Score':[45,55,50,42,48,51,46,56,49,47],
'Matches_ played':[30,35,32,33,31,29,34,30,36,37]
})
players. set_ index('Player' ,in place=True)
players[['Highest_ Score', 'Lowest_ Score']].plot(kind='bar', fig size=(10, 6)) plt.
title('Highest and Lowest Score for Players')
plt. X label('Players') plt.Y
label('Scores') plt. X
ticks(rotation=45) plt. show()
OUTPUT:-

12
13) Create line graph for temp. of seven days of week
CODE:-
Import matplotlib.pyplot as plt
days_of_week=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'] temperature
= [65, 68, 70, 72, 59, 57, 73]
plt. plot (days_ of_ week, temperature, marker='o', line style='-')
plt. title('Temperature for Seven Days of the Week')
plt.xlabel('Day of the Week')
plt.ylabel('Temperature(°F)')
plt.show()
OUTPUT:-

13
14) Create histogram to show sales of one month data.

CODE:-

Import matplotlib.pyplot as plt

sales_data=[110,125,125,145,135,115,110,120,135,140,130,130,140,175,135,145,125,
135,140,150,140,130,160,155,125,160,140,145]

plt.hist (sales_ data, bins=15, edge color='y')

plt.title ('Sales Histogram for One Month')

plt.xlabel ('Sales Amount')

plt.ylabel('Frequency')

plt.show()

OUTPUT:-

14
15) Create c s v file from data frame players. Make sure null values are
handled properly.
CODE:-
players=pd. DataFrame({
'Player':['Player1','Player2','Player3','Player4','Player5','Player6','Player7','Player8','Player9', 'Player10'],
'Highest_ Score':[100,150,80,None,200,90,110,130,None,170],
'Lowest_ Score':[30,40,20,50,60,35,25,None,55,70],
'Matches_ played':[50,None,60,55,40,48,None,42,47, 49]
})
players. set_ index('Player', in
place=True) players=players.
Fillna(‘N/A’) players. To _c s v
(‘players_data.csv’) OUTPUT:-

16) Create c s v file in excel. Open c s v in data frame. Make use of n rows
command.
CODE:-
import pandas as pd Df=pd. read_
c s v (‘c s v .c s v ’,n rows=5)
print(Df)
OUTPUT:-

15
MY SQL PROGRAMS
Create the following table products.

PCODE P name Qty Price Company

P1001 I Pad 120 15000 Apple

P1002 LEDTV 100 85000 Sony

DSLR
P1003 Camera 10 25000 Philips

P1004 I Phone 50 95000 Apple

P1005 LEDTV 20 45000 MI

Bluetooth
P1006 Speaker 100 20000 Ahuja

16
1) Show table structure.

2) Show record soft able products.

3) ShowproductsofpCODEP1001andP1005.

17
4) Show data of products starting with I .

5) Showdataofallproductswhosequantity>50andprice>30000.

6) Show sum of price of all products.

7) Show product names in upper case and also length of all products

18
8) Show product name and qty joined with space under
heading “product and Qty”.

9) Display first 2 and last 2 letters from p name.

19
10) Write queries using empl table:

Show total employees working in each department

Show avg salary of each job.

Show min salary of each department where minimum employees are>3.

20
11) Write queries using empl and dept table:

Show employee names and their location of job.

Show avg salary of employees working in sales department

Show e name, salary, d name and location of all employees.

21
12) Display current date and time.

13) Display day of week ,day of year and day name for current date.

14) Write query to drop the table product.

22

You might also like