100% found this document useful (7 votes)
35K views22 pages

IP Practical File 2024-25

Ip practice file
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
100% found this document useful (7 votes)
35K views22 pages

IP Practical File 2024-25

Ip practice file
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

SHREE SWAMINARAYAN ENGLISH MEDIUM SCHOOL (CBSE) SALVAV,VAPI

CERTIFICATE
This is to certify that Ms./Mr._________________________
board roll number ______________ student of class XII
SCIENCE from SHREE SWAMINARAYAN GURUKUL,SALVAV

has successfully completed his practical work for


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

____________________ ____________________ _____________


External examiner Teacher in-charge Principal

School Seal

1
INTRODUCTION

NAME :

CLASS : XII Science

SUBJECT : Informatics Practices

SCHOOL: Shree Swaminarayan English Med. CBSE school Salvav

SUBMITTED TO : Mrs. Archana Deshmukh

2
ACKNOWLEDGEMENT
I would like to thank my teacher Mrs.
ARCHANA DESHMUKH and principal ma’am Mrs.
Minal Desai for giving me the opportunity to do this
practical file. This also helped me in doing a lot of
research and increased my knowledge in difficult topics.

3
INDEX
PYTHON PROGRAMS
Sr.No Questions Tr.Sign.
1. Create a series of these numbers:33,55,65,29,19,23.
2. Create a series of 10 numbers starting with 41 and with the
increment of 3.
3. Create a series of 10 numbers using ndarray.
4.
Create a series and print the top 3 and bottom 3 elements using
the head and tail functions.
5. Write code to show al attributes of series. Use series in Q1.
6. Use Series created in Q2 ad find output of following commands:-
s[::2] , s[1:3] & s[[1,3,4]].

7
Write code to change value 29 and 23 from series Q1.

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


9. Create a dataframe countries using a dictionary which stored 5
country name, capitals and populations of the country. Index will
be years.
10. Write a program to show all attributes of dataframe created in
Q9.
11. Create a dataframe players to store 10 players with their highest
and lowest score no_of matches columns. Player names are
indices of dataframe. 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.

12. Make multiple bar graph for dataframe created in Q11.


13. Create line graph for temp. seven days of week.

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

15. Create csv file from dataframe players. Make sure null values are

4
handled properly.
16. Create csv file in excel. Open csv in dataframe. Make use of nrows
command.

MYSQLPROGRAMS
1.
Create database DATA
Create the following table product
Table: Products
Pcode Pname Qty Price Company
P1001 Ipad 15000 Apple
P1002 LED TV 85000 Sony
P1003 DSLR 25000 Philips
CAMERA
P1004 iPhone 95000 Apple
P1005 LED TV 45000 MI
P1006 Bluetooth 20000 Ahuja
Speaker

2. Show table structure.


3. Show records of table products.
4. Show products of pcode P1001 and P1005.
5. Show data of products starting with i.
6. Show data of all products whose quantity>50 and 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. Display first 2 and last 2 letters from Pname.


11. 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.
12. Write queries using empl and dept table:
Show employee names and location of job.
Show avg salary of employees working in sales department.
Show ename, salary,dname, and location and all employees.
13. 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
PYTHON PROGRAM
1) Create a series of these numbers: 33,55,65,29,19,23.
CODE:-
import pandas as pd
s1=pd.Series([33,55,65,29,19,23])
print(s1)
OUTPUT:-

2) Create a series of 10 numbers starting with 41 and with the increment of3.
CODE:-
import pandas as pd
sn = 41
im = 3
a= []
for i in range(10):
a.append(sn)
sn = sn+im
m=pd.Series(a)
print(m)
OUTPUT:-

6
3) Create a series of 10 numbers using ndarray.

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

4) Create a series and print the top 3 and bottom 3 elements using the head
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) Write CODE to show all attributes of series. Use series created in Q1.

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

6) Use Series created in Q2 and 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)
Write CODE to change value 29 and 23 from series of Q1.
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 as pd
import numpy as np
s=pd.Series(np.arange(1, 11))
print(s)
s=s.sort_values(ascending=False)
print(s)
OUTPUT:-

9
9) Create a dataframe countries using a dictionary which stored 5
countryname, capitals and 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)Write program to show all attributes of dataframe created in Q9.


CODE:-
import pandas as pd
import numpy as np

data = {'Country': ['United States', 'France', 'Brazil', 'Japan', 'Australia'],


'Capital': ['Washington, D.C.', 'Paris', 'Brasília', 'Tokyo', 'Canberra'],
'Population': [1000000, 2000000, 1500000, 2500000, 1800000]}

S10 = pd.DataFrame(data, index=[2020, 2021, 2022, 2023, 2024])


print(S10[:])

OUTPUT-

10
11)
Create dataframe players to store 10 players with their highest and lowest
score no_of matches columns. Player names are indices of dataframe. 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.DataFrame( {
‘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', inplace=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'}, inplace=True)
print('Drop the row of the last player')
players.drop('Player10', inplace=True)
print('Display the updated DataFrame')
print(players)
OUTPUT:-

11
12) Make multiple bar graph for dataframe created in Q.11

CODE:-
import pandas as pd
import matplotlib.pyplot as plt
players = pd.DataFrame({
'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', inplace=True)
players[['Highest_Score', 'Lowest_Score']].plot(kind='bar', figsize=(10, 6))
plt.title('Highest and Lowest Score for Players')
plt.xlabel('Players')
plt.ylabel('Scores')
plt.xticks(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', linestyle='-')
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, edgecolor='y')

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

plt.xlabel('Sales Amount')

plt.ylabel('Frequency')

plt.show()

OUTPUT:-

14
15) Create csv file from dataframe 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', inplace=True)
players=players.fillna(‘N/A’)
players.to_csv(‘players_data.csv’)
OUTPUT:-

16) Create csv file in excel. Open csv in dataframe. Make use of nrows
command.
CODE:-
import pandas as pd
Df=pd.read_csv(‘csv.csv’,nrows=5)
print(Df)
OUTPUT:-

15
MYSQLPROGRAMS
Create the following table products.

PCODE Pname Qty Price Company

P1001 iPad 120 15000 Apple

P1002 LED TV 100 85000 Sony

DSLR
P1003 Camera 10 25000 Philips

P1004 iPhone 50 95000 Apple

P1005 LED TV 20 45000 MI

Bluetooth
P1006 Speaker 100 20000 Ahuja

16
1) Show table structure.

2) Show records of table products.

3) Show products of pCODE P1001 and P1005.

17
4) Show data of products starting with i.

5) Show data of all products whose quantity >50 and price >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 pname.

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 ename,salary,dname 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