IP Practical File 2024-25
IP Practical File 2024-25
CERTIFICATE
This is to certify that Ms./Mr._________________________
board roll number ______________ student of class XII
SCIENCE from SHREE SWAMINARAYAN GURUKUL,SALVAV
School Seal
1
INTRODUCTION
NAME :
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.
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
9.
Show product name and qty joined with space under heading “Product and Qty”.
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:-
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-
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:-
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.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.
DSLR
P1003 Camera 10 25000 Philips
Bluetooth
P1006 Speaker 100 20000 Ahuja
16
1) Show table structure.
17
4) Show data of products starting with i.
5) Show data of all products whose quantity >50 and price >30000.
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”.
19
10) Write queries using empl table:
Show min salary of each department where minimum employees are >3.
20
11) Write queries using empl and dept table:
21
12) Display current date and time.
13) Display day of week,day of year and day name for current date.
22