0% found this document useful (0 votes)
18 views60 pages

Swastika

This document is a practical report for Informatics Practices submitted by Swastika Bokil for the academic session 2025-2026. It includes a certificate of completion, acknowledgments, and a detailed index of Python programming tasks related to data manipulation and visualization using Pandas and SQL. The report outlines various coding exercises aimed at developing skills in data handling and analysis.

Uploaded by

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

Swastika

This document is a practical report for Informatics Practices submitted by Swastika Bokil for the academic session 2025-2026. It includes a certificate of completion, acknowledgments, and a detailed index of Python programming tasks related to data manipulation and visualization using Pandas and SQL. The report outlines various coding exercises aimed at developing skills in data handling and analysis.

Uploaded by

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

PRACTICAL REPORT

OF
INFORMATICS PRACTICES

XII-
Commerce
Session: 2025-2026

Submitted to:
Submitted by: Swastika Bokil

Mr. A.S.R. Satapathy


PGT Informatics Practices

1
CERTIFICATE

This is to certify that

of class

XII-Commerce has successfully completed

her Practical Report in Informatics Practices

for the partial fulfillment of SSCE as

prescribed by CBSE in the year 2025-2026.

Date:

Registration No:

__________________ ______________
Mr. A.S.R Satapathy Mrs. Gargi
Banerjee
(PGT. Informatics Practices) (Principal)

2
_____________
(External)

ACKNOWLEDGEMENT

I would like to express my heart filled thanks to


the principal of my school, Mrs. Gargi
Banerjee, for giving the facilities of a good
laboratory and library, which is having book of
various authors.

I Swastika Bokil student of class XII


Commerce, deem it my privilege for this
opportunity to express deep and sincere
gratitude and acknowledgement to the guidance
of my respected Informatics Practices teacher
Mr.A.S.R Satapathy, PGT Informatics
Practices, Shree Vallabh Ashram’s M.C.M.
Kothari International Girls Residential
School, Killa-Pardi, Valsad(Gujarat), who
helped me a lot by giving valuable suggestions
and guidance for the assigned project and led to
its successful completion.

3
Thanking you,

INDEX
SR. PAGE
NO PARTICULARS NO SIGN

Python Pandas
1. Write python code to create a series object temp2 storing
temperatures of seven days of week. Its indexes should
be ’Sunday’, ‘Monday’,…..’Saturday’.
2. A series object (say T1) stores the average temperature
recorded on each day of month. Write code to display the
temperatures recoded on:(I)first 7 days (ii)last 7 days

3. From the df5 used above , create another DataFrame and


it must not contain the column 'Population' and the row
Banglore
4. Given a DataFrame namely aid that stores the aid by NGOs
for different states:

Write a program to display the aid for


(1)Books and Uniform only
(2) Shoes only
5. A list stores three dictionaries each storing details (old
price, new price, change). Write a Program to create a
DataFrame from it.
6. Write a program to create a Series object using an ndarray
that has 5 elements in the range 24 to 64.
7. Write a program to create a Series object using an ndarray
that is created by tiling a list [3,5] twice.
8. Consider the dataframe salesDf. Write a program to add
column namely Orders having values
6000,6700,6200,6000 respectively for the zones A,B,C and
D. The program should also add a new row for a new
zone ZoneE. Add some dummy values in this row.
9. write a program to create a dataframe from a ist
containing dictionaries of the sales performance of four

4
zonal offices. Zone name should be in a row lables
10. consider two series object staff and salaries that store the
number of people in various office branches and salaries
distribted in these brances, respectively.

write a program to create another series object that stores


average salary per branch and then create a DataFrame
object from these Series objects.
11. A series object trdata consists of around 2500 rows of
data.Write a program to print the following details:
#(i)Frist 100 rows of data (ii)last 5 rows of data
12. Number of students in class 1 1 and 12 in three streams
('Science','Commerce','Humanities')are stored in two
Series objects c11 and 12.Write code to find total number
of students in classes 11 and 12,stream wise.
13. write a program to create a DataFrame storing salesman
details (name,zone,sales)of five salesman
14. Write a program to create data series and then change the
indexes of the Series object in any random order.
15. Four dictionaries store the details of four employees-of-
the-month as(empno,name).Write a program to create a
dataframe from these.
16. From the series ser1 of areas that stores areas of states in
km2,find out the area that are more than 50000 km2.
17. Given series object s5.write a programe to store the
square of the series values in the object s6.display s6’s
values which are >15.
18. Write a program to create a Series object that stores the
initial budget allocated (50000/-each) for the four quarters
of the year: Qtr1,Qtr2,Qtr3, and Qtr4.
19. Sequences section and contri1 store the section
names('A','B','C','D','E') and contribution made by them
respectively(6700,5600,5000,5200,nil) for a charity.Your
school has decide to donate as much contribution as made
by each section, i.e., the donation will be doubled. write
code to creat a Series object that stores the contribution
amount as the values and the section names as the
indexws with datatype as float32.
20. Write a Program to enter the number and print whether
the number is odd or even.
21. Given a series that stores the area of some states in km2.
Write code to find out the biggest and smallest three areas
from the given Series. Given series has been created like
this:Ser1=pd.series([34567,890,450,67892,34677,78902,2
56711,678291,637632,25723,2367,11789,345,256517])
22. write pythn code to create a series object 'temp1' that

5
stores temperature of seven days in it. take any random
seven temperature.
23. Draw the histogram for population_ages = [22, 55, 62, 45,
21,
22,34,42,42,4,99,102,110,120,121,122,130,111,115,112,8
0,75,65,54,44,43,42,48] and bins = [0, 10, 20, 30, 40, 50,
60, 70, 80, 90, 100, 110,120,130] through python program
with suitable title and label.
24. object1 population stores the details of population in four
metro cities of India and object2 Av income stores the
total average income reported in previous year in each of
these metros. Calculate income per capita for each of
these metro cities.
25. Create and display a data frame from a 2D dictionary,
sales, which stores the quarter-wise sales as
inner dictionary for two years, as shown below:
sales={'yr1':
{'qtr1':34500,'qtr2':56000,'qtr3':47000,'qtr4':49000},'yr2':
{'qtr1':44900,'qtr2':46100,'qtr3':57000,'qtr4':59000}}

26. Write a program to display number of rows and number of


columns in data frame df without using
shape attribute.
27. Series objects Temp1, Temp2, Temp3, Temp4 store the
temperatures of days of week1, week2, week3, week4
respectively. Write a script to print the average
temperature per week

28. Three Series object store the marks of 10 students in three


terms. Roll numbers of students form the index of these
Series objects. The Three Series objects have the same
indexes. Calculate the total weighted marks obtained by
students as per following formula:
Final marks=25% Term 1+ 25% Term2+ 50% Term3
29. Write a program to create a series object that stores the
table of number 5
30. Write a program to create a series object from ndarray
that stores characters from'a'to'g'
Data Visualization with Pyplot
31. Generally ten different prices of a stock are stored.
However, for ABC Co. only 5 prices are available for a day:
[74.25,76.06,69.5,72.55,81.5]
Write a Program to create a bar chart with the given
prices:
 The graph should be plotted between the limits -2
to 10 on x-axis.
 There should be tick for every plotted point.

6
32. TSS school celebrated volunteering week where each
section of class XI dedicated a day for collecting amount
for charity being supported by the school. Sections A
volunteered on Monday, B on Tuesday, C on Wednesday
and soon. There are six sections in class XI. Amounts
collected by sections A to F are
8000,12000,9800,11200,15500,7300.
Write a program to create a bar chart showing collection
amount. The graph should have proper title and axes
titles.
33. Considering the TSS school collection for charity of
previous example. Write a program to plot the collected
amount vs days using a bar chart. The ticks on X-axis
should have Day names. The graph should have proper
title and axes titles.
34. Prof Awasthi is doing some research in the field of
Environment. Write a Program to plot this data on a
horizontal histogram with this data.
35. Consider the reference table.Write a program to plot a bar
chart from the medals won by India. Make sure that Gold,
Silver, Bronze and Total tally is represented through
different colours
36. Given a series NFIB that contains reversed Fibonacci
numbers with Fibonacci numbers as shown below:
[0,-1,-1,-2,-3,-5,-8,-13,-21,-34,0,1,1,2,3,5,8,13,21,34]
37. Draw the histogram based on the Production of Wheat in
different Years
Year:2000,2002,2004,2006,2008,2010,2012,2014,2016,20
18. Production':4,6,7,15,24,2,19,5,16,4
SQL
38 Show databases

39 01. Create table item_info1 having following fields


information Icode of string type,Inm of string
type,Descp of string type,Price of decimal type,
Qua of integer type

40 Insert values into the table item_info1


41 Display all the information of the table item_info1
42 Add primary key in the table using table constraint
43 01.Update the value quantity based on the
7
condition.

44 change the structure of table by adding a new


column
45 To display a report, showing item information with
icode in descending order
46 02.Show all the information about the “laptop” ;

47 03.Display all information whose name starts


with ‘la’.

48 Count the records of table item_info


49 Show maximum price of the item_info1 table
50 Display the sum of all prices
51 Display the minimum quantity of the table.
52 Increase price of item by 10%(table item_info).
53 Display the distinct item price of the table
item_info1.
54 Display the information according to given list of
price using a list(using IN operator)
55 View structure of the table
56 Display the information according to given list of
price using a list(using IN operator)
57 View structure of the table
58 delete the information of “Books”
59 Display the information of the item code
“ABC104”.
8
60 Display the information whose price is between
100 to 1000.
61 Remove the primary key constraint from the table
62 Delete table item_info1 and its structure
63 Drop the database

Program 01:
Write python code to create a series object
temp2 storing temperatures of seven days of
week. Its indexes should be ’Sunday’, ‘Monday’,
…..’Saturday’.
Screenshots:

Source Code:

import pandas as pd
import numpy as np
temp2=([33.5,41.3,42,44.6,46.8,49,42.1])
days=['mon','tue','wed','thru','fri','sat','sun']
s=pd.Series(data=temp2,index=days)
print(s)

9
Program 02:
A series object (say T1) stores the average
temperature recorded on each day of month.
Write code to display the temperatures recoded
on:(I)first 7 days (ii)last 7 days.

Screenshot:

Source Code:
t1=([33.5,41.3,42,44.6,46.8,49,42.1,43.4,40.9,33
.6,49,33,45,48.0,46.1,
36.9,33,35,43.5,38.4,25,32.6,25.9,24,29.6,28.3,2
3,27.8,25.9,])

10
s1=pd.Series(t1)
print(s1.head(7))
print(s1.tail(7))

Program 03:

Dataframe is:
Population Hospitals Schools
Delhi 10927986.0 189.0 7916.0
Mumbai 12691836.0 208.0 8508.0
Kolkata 4631392.0 149.0 7226.0
Chennai 4328063.0 157.0 7617.0
Bangalor 5678097.0 1200.0 1200.0
e
Use the above data frame and create another
data Frame and it must not contain the column
'Population' and the row Banglore.

Screenshot:

11
Source Code:
dic={'Population':
[10998765.0,12612345.0,4658912.0,4309812.0,56712
30.0],
'Hospitals':[189.0,208.0,149.0,157.0,1200.0],
'Schools':[7916.0,8508.0,7226.0,7617.0,1200.0]}
df=pd.DataFrame(dic,index=['Delhi','Mumbai','Kolkata',
'Chennai','Banglore'])
print(df)
df6=pd.DataFrame(df)
del df6['Population']
df6=df6.drop(['Banglore'])
print(df6)

Program 04:

Given a DataFrame namely aid that stores the


aid by NGOs for different states: Write a program
to display the aid for
(1)Books and Uniform only
(2)Shoes only
Screenshot:

12
Source Code:
import pandas as pd
aid={'Toys':[7916,8508,7226,7617],'Books':
[6189,8208,6149,6157],'Unifrom':
[610,508,611,457],'Shoes':
[8810,6798,9611,6457]}
df1=pd.DataFrame(aid)
df2=pd.DataFrame(aid,index=['Andhra','Odisha','
M.P','U.P'])
print(df2)
print(df2[['Books','Unifrom']])
print(df2.Shoes)

Program 05:

A list stores three dictionaries each storing


details (old price, new price, change). Write a
Program to create a DataFrame from it.

13
Screenshot:

Source Code:

import pandas as pd
df={'Old Price':[3000,5000,6900,7800],
'New Price':[3500,6000,7000,8000],
'Change':[500,1000,100,200]}
data=pd.DataFrame(df)
print(data)

Program 06:

Write a program to create a Series object using


an ndarray that has 5 elements in the range 24
to 64.

14
Screenshot:

Source Code:

import numpy as np
import pandas as pd
s=pd.Series(np.linspace(24,64,5))
print(s)

Program 07:

Write a program to create a Series object using


an ndarray that is created by tiling a list [3,5]
twice.
15
Screenshot:

Source Code:
import numpy as np
import pandas as pd
s1=pd.Series(np.tile([3,5],2))
print(s1)

Program 08:

Consider the dataframe salesDf. Write a program


to add column namely Orders having values
6000,6700,6200,6000 respectively for the zones
16
A,B,C and D.The program should also add a new
row for a new zone ZoneE. Add some dummy
values in this row.

Screenshot:

Source Code:
dic={'target':
[56000,70000,75000,60000],'sales':
[58000,68000,78000,61000]}
salesDf=pd.DataFrame(dic,index=['ZoneA','Zone
B','ZoneC','ZoneD'])
print(salesDf)
salesDf['Orders']=[6000,6700,6200,6000]
salesDf.loc['ZoneE',:]=[50000,45000,5000]
print(salesDf)

Program 09:

17
Write a program to create a dataframe from a ist
containing dictionaries of the sales performance
of four zonal offices. Zone name should be in a
row lables

Screenshot:

Source Code:

import pandas as pd
ZoneA={'Target':56000,'sales':58000}
ZoneB={'Target':70000,'sales':68000}
ZoneC={'Target':75000,'sales':78000}
ZoneD={'Target':60000,'sales':61000}
sales=[ZoneA,ZoneB,ZoneC,ZoneD]
salesDf=pd.DataFrame(sales,index=['ZoneA','Zo
neB','ZoneC','ZoneD'])
print(salesDf)

18
Program 10:
Consider two series object staff and salaries that
store the number of people in various office
branches and salaries distributed in these
brances,respectively.
write a program to create another series object
that stores average salary per branch and then
create a DataFrame object from these Series
objects.

Screenshot:

Source Code:

import pandas as pd
import numpy as np
staff=pd.Series([20,36,44])
salaries=pd.Series([279000,396800,563000])
avg=salaries/staff
org={'people':staff,'Amount':salaries,'Average':a
vg}
dtf5=pd.DataFrame(org)
print(dtf5)

19
Program 11:
A series object trdata consists of around 2500
rows of data.Write a program to print the
following details: #(i)Frist 100 rows of data
(ii)last 5 rows of data
Screenshot:

Source Code:
import pandas as pd
trdata=pd.Series(range(1,2501,1))
print(trdata)
print(trdata.head(100))
20
print(trdata.tail())

Program 12:
Number of students in class 1 1 and 12 in three
streams ('Science','Commerce','Humanities')are
stored in two Series objects c11 and 12.Write
code to find total number of students in classes
11 and 12,stream wise.

Screenshot:

Source Code:

import pandas as pd
c11=pd.Series(data=[30,40,50],index=['science',
'commerce','humanities'])
c12=pd.Series(data=[37,44,45],index=['science',
'commerce','humanities'])
print("total no.of students")
print(c11+c12)

21
Program 13:

Write a program to create a DataFrame


storing salesman details
(name,zone,sales)of five salesman.

Screenshot:

Source Code:

import pandas as pd
import numpy as np
d={"name":
['name1','name2','name3','name4','name5'],
"zone":
['zone1','zone2','zone3','zone4','zone5'],"sales":
[100,200,10,350,250]}
df=pd.DataFrame(d)
print(df)
22
Program 14:

Write a program to create data series and then


change the indexes of the Series object in any
random order.

Screenshot:

Source Code:

import pandas as pd

23
import numpy as np
s=pd.Series(data=[100,200,300,400,500],index=
['I','J','K','L','M'])
print("Original Data Series:")
print(s)
s=s.reindex(index=['k','I','M','L','J'])
print("Data Series after changing the order of
index:")
print(s)

Program 15:

Four dictionaries store the details of four


employees-of-the-monthas(empno,name).Write a
progra to creat a dataframe from these.

Screenshot:

Source Code:

import pandas as pd
import numpy as np

24
d={"name":'name',"empno":1}
d1={"name":'name1',"empno":2}
d2={"name":'name2',"empno":3}
d3={"name":'name3',"empno":4}
s=pd.DataFrame([d,d1,d2,d3])
print(s)

Program 16:

From the series ser1 of areas that stores areas of


states in km2,find out the area that are more
than 50000 km2.

Screenshot:

Source Code:

25
import pandas as pd
ser1=pd.Series([34567,890,450,67829,34677,78
902,356711,678291,
637632,25723,2367,11789,345,256517])
print(ser1[ser1>50000])

Program 17:

Given series object s5.Write a programme to


store the square of the series values in the object
s6.Display s6’s values which are >15.

Screenshot:

Source Code:

26
import pandas as pd
s5=pd.Series([12,16,21,15,10,18])
print('series object s5:')
print(s5)
s6=s5*2
print('value in s6>15:')
print(s6[s6>15])

Program 18:

Write a program to create a Series object that


stores the initial budget alloted (50000/-each) for
the four quaters of the year: Qtr1,Qtr2,Qtr3, and
Qtr4.

Screenshot:

27
Source Code:

import pandas as pd
s=pd.Series(50000,index=['Qtr1','Qtr2','Qtr3','Qtr
4'])
print(s)

Program 19:

Sequences section and contri1 store the section


names('A','B','C','D','E') and contribution made by
them respectively(6700,5600,5000,5200,nil) for a
charity.Your school has decide to donate as much
contribution as made by each section, i.e., the
donation will be doubled. write code to creat a
Series object that stores the contribution amount
as the values and the section names as the
indexws with datatype as float32.

Screenshot:

28
Source Code:
import pandas as pd
import numpy as np
section=['A','B','C','D','E']
contri1=np.array([6700,5600,5000,5200,np.NaN]
)
s=pd.Series(data=contri1*2,index=section,dtype
=np.float32)
print(s)

Program 20:
Write a Program to enter the number and print whether the
number is odd or even.

Screenshot:

29
Source Code:
num=int(input("Enter any number"))
if num%2==0:
print("Even Number")
else:
print("Odd Number")

Program 21:
Given a series that stores the area of some states
in km2. Write code to find out the biggest and
smallest three areas from the given Series.Given
series has been created like this:
Ser1=pd.series([34567,890,450,67892,34677,78

30
902,256711,678291,637632,25723,2367,11789,
345,256517])

Screenshot:

Source Code:

import pandas as pd

Ser1=pd.Series([34567,890,450,67892,34677,78
902,256711,678291,637632,25723,2367,11789,
345,256517])
print("Top 3 biggest areas are:")
print(Ser1.sort_values().tail(3))
print("3 smallest areas are:")
print(Ser1.sort_values().head(3))

Program 22:

31
Write a Python code to create a series object
'temp1' that stores temperature of seven days in
it. take any random seven temperature.

Screenshot:

Source Code:

deg=[17.6,25.6,20.9,33,10.4,12.6,29.8]
temp1=pd.Series(deg,index=['monday','tuesday'
,'wednesday','thursday','friday','saturday','sunda
y'])
print(temp1)

Program 23:

32
Write a program to rename indexes of ‘zonec’
and ‘zoneD’ as ‘cental’, and ‘dakshin’
respectively and the column name ‘target’ and
‘sales’ as ‘targeted’ and ‘achieved’ respectively

Screenshot:

Source Code:

print(temp1)
dict1={'target':
[56000,70000,75000,6000]},'sales':
[58000,68000,78000,61000]}
salesdf=pd.DataFrame(dict1,index=['zoneA','zon
eB','zoneC','zoneD'])
print(salesdf)
print('------RENAMING INDEX OF ZONE C AND
D-------')
print(salesdf.rename(index={'zoneC':'central','zo
neD':'dakshin'}))
print('-----RENAMING COLUMN AND TARGET AND
SALES--------')

33
print(salesdf.rename(column={'target':'targeted'
,'sales':'achieved'}))

Program 24:
object1 population stores the details of
population in four metro cities of India and
object2 avg income stores the total average
income reported in previous year in each of these
metros. Calculate income per capita for each of
these metro cities.

Screenshot:

Source Code:
population=pd.Series([10627986,12691836,4631
1836,4328063],\
index=['delhi','mumbai','kolkata','chennai'])
avgincome=pd.Series([72167810927986,850871
2691836,4226784631392,5261784328063],\

34
index=['delhi','mumbai','kolkata','chennai'])
percapita=avgincome/population
print("population in four metro cities")
print(population)
print("avg.income in four mrteo cities")
print(avgincome)
print("per capita income in four metro cities")
print(percapita)
Program 25:
Create and Display a dataframe from a 2D
dictionary,sales,which stores the quarter-wise
sales as. inner dictionary for two years,as shown
below sales={'yr1':
{'qtr1':34500,'qtr2':56000,'qtr3':47000,'qtr4':490
00},
'yr2':
{'qtr1':44900,'qtr2':46100,'qtr3':57000,'qtr4':590
00}}

Screenshot:

Source Code:

import pandas as pd

35
sales={'yr1':
{'qtr1':34500,'qtr2':56000,'qtr3':47000,'qtr4
':49000},
'yr2':
{'qtr1':44900,'qtr2':46100,'qtr3':57000,'qtr4
':59000}}
dfsales=pd.DataFrame(sales)
print(dfsales)

Program 26:

Write a program to display number of rows and


number of columns in data frame df without
using Shape attribute

Screenshot:

Source Code:

36
dic={'A':[1,2,3,4],'B':[5,6,7,8],'C':[9,10,11,12]}
df=pd.DataFrame(dic)
print(df)
rows=len(axes [0])
cols=len(df.axes[1])
print("no.of rows:",rows)
print("no.of columns:",cols)

Program 27:

Series objects Temp1, Temp2, Temp3, Temp4


store the temperatures of days of week1, week2,
week3, week4 respectively. Write a script to
a) Print the average temperature per week

Screenshot:

37
Source Code:
import pandas as pd

avg_tem=[28.4,30.55,25,35,37,39,28,\
28,30.8,25.0,35,35.4,29,27.1,\

24,30,21,31,37,39,32.5,\

28,30,28.8,35,37,39,28,\
28,30,25]
Temp1 = pd.Series(avg_tem[:7])
Temp2 = pd.Series(avg_tem[8:15])
Temp3 = pd.Series(avg_tem[16:23])
Temp4 = pd.Series(avg_tem[23:30])
print('Average temp of week1 \n',
Temp1.sum()/7)
print('Average temp of week2 \n',
Temp2.sum()/7)
print('Average temp of week3 \n',
Temp3.sum()/7)
print('Average temp of week4 \n',
Temp4.sum()/7)
Program 28:
Three Series object store the marks of 10
students in three terms. Roll numbers of students

38
form the index of these Series objects. The Three
Series objects have the same indexes.
Calculate the total weighted marks obtained by
students as per following formula:
Final marks=25% Term 1+ 25% Term2+ 50%
Term3

Screenshot:

Source Code:

import pandas as pd
Term1 =
pd.Series([40,35,25,20,22,26,28,29,23,28])
Term2 =
pd.Series([28,15,37,38,45,41,48,47,30,20])
Term3 =
pd.Series([36,23,34,31,21,22,23,24,26,28])
final_mark = (Term1*25)/100 + (Term2*25)/100
+ (Term3*50)/100
print(final_mark)

39
Program 29:
Write a program to create a series object that
stores the table of number 5
Screenshot:

Source Code:
import pandas as pd
import numpy as np
tab = np.arange(5,55,5)
ser = pd.Series(tab)
print(ser)

40
Program 30:
Write a pogram to create a series object from
ndarray that stores characters from 'a' to 'g'.

Screenshot:

Source Code:
import pandas as pd
import numpy as np
arr = np.array(list('abcdef'))
print(arr)
s1 = pd.Series(arr)
print(s1)

41
Program 31:
Generally, ten different prices of a stock are
stored. However, for ABC Co. only 5 prices are
available for a day:[74.25,76.06,69.5,72.55,81.5]
Write a Program to create a bar chart with the
given prices:
 The graph should be plotted between the
limits -2 to 10 on x-axis.
 There should be tick for every plotted
point.
Screenshot:

Source Code:
Import matplotlib.pyplot as plt
Import numpy as np
pr=[74.25,76.06,69.5,72.55,81.5]
plt.bar(range(len(pr)),pr,width=0.4,color='pink')
42
plt.xlim(-2,10)
plt.title("Prices of Abc Co.")
plt.xticks(range(-2,10))
plt.ylabel("Prices")
plt.show()
Program 32:
TSS school celebrated volunteering week where
each section of class XI dedicated a day for
collecting amount for charity being supported by
the school. Sections A volunteered on Monday, B
on Tuesday, C on Wednesday and soon. There
are six sections in class XI. Amounts collected by
sections A to F
are8000,12000,9800,11200,15500,7300.
Write a program to create a bar chart showing
collection amount. The graph should have proper
title and axes titles.
Screenshot:

Source Code:
import matplotlib.pyplot as plt

43
import numpy as np
Col=[8000,12000,9800,11200,15500,7300]
x=np.arange(6)
plt.title("Volunteering Week Collection")
plt.bar(x,Col,color="indigo",width=0.25)
plt.xlabel("Days")
plt.ylabel("Collection")
plt.show()
Program 33:
Draw the histogram for population_ages = [22, 55, 62, 45, 21,
22,34,42,42,4,99,102,110,120,121,122,130,111,115,112,80,7
5,65,54,44,43,42,48] and bins = [0, 10, 20, 30, 40, 50, 60, 70,
80, 90, 100, 110,120,130] through python program with
suitable title and label.

Screenshot:

Source Code:
import matplotlib.pyplot as plt

44
population_age =
[22,55,62,45,21,22,34,42,42,4,2,102,95,85,55,11
0,120,70,65,55,111,115,80,75,65,54,44,43,42,48
]
bins = [0,10,20,30,40,50,60,70,80,90,100]
plt.hist(population_age, bins, histtype='bar',
rwidth=0.8)
plt.xlabel('age groups')
plt.ylabel('Number of people')
plt.title('Histogram')
plt.show()

45
Program 34:
Prof Awasthi is doing some research in the field
of Environment. For some plotting purposes he
has generated some data as:
mu=100
sigma=15
x=mu+sigma*numpy.random.randn(10000)
Write a program to plot this data on a horizontal
histogram with this data.
Screenshot:

46
Source Code:
import matplotlib.pyplot as plt
import numpy as np
mu=100
sigma=15
x=mu+sigma*np.random.randn(10000)
plt.hist(x,bins=30,orientation='horizontal',color=
['navy'])
plt.title('Research data Histogram')
plt.show()

Program 35:
Draw the histogram based on the Production of Wheat in
different Years
Year:2000,2002,2004,2006,2008,2010,2012,2014,2016,2018
Production':4,6,7,15,24,2,19,5,16,4
Screenshot:

Source Code:
47
import pandas as pd
import matplotlib.pyplot as plt
data={'Year':
[2000,2002,2004,2006,2008,2010,2012,2014,20
16,2018],\
'Production':[4,6,7,15,24,2,19,5,16,4]}
d=pd.DataFrame(data)
print(d)
x=d.hist(column='Production',bins=5,grid=True)
plt.show(x)

Program 36:

Given a series nfib that contains reversed Fibonacci


numbers with Fibonacci numbers as shown below:
[0,-1,-1,-2,-3,-5,-8,-13,-21,-34,0,1,1,2,3,5,8,13,21,34]
Write a program to plot nfib with following specifications:
i) The line color should be magnets
ii) The marker edge color should be black with size 5
iii) Grid should be displayed
Screenshot:

48
Source Code:
import matplotlib.pyplot as plt
import numpy as np
nfib=[0,-1,-1,-2,-3,-5,-8,-13,-21,-
34,0,1,1,2,3,5,8,13,21,34]
plt.plot(range(-
10,10),nfib,'mo',markersize=5,markeredgecolor=
'k',linestyle='solid')
plt.grid(True)
plt.show()
Program 37:
Consider the reference table 3.1. Write a
program to plot a bar chart from the medals won
by Australia . In the same chart, plot medals won
by India too
Screenshot:

49
Source Code:

import matplotlib.pyplot as plt


Info=['Gold','Silver','Bronze','Total']
Australia=[80,59,59,198]
India=[26,20,20,66]
plt.bar(Info,Australia)
plt.bar(Info,India)
plt.xlabel("Medal type")
plt.ylabel("Australia,India Medal count")
plt.show()

SQL Queries
Screenshots & Source Code:

01. Show databases;

Query:show databases;

50
Screenshot:

02. Create table item_info1 having following fields information Icode of string
type,Inm of string type,Descp of string type,Price of decimal type, Qua of integer
type
Query:create table
item_info1(icodevarchar(20),item_namevarchar(20,descp
varchar(20),price decimal, Qua int);
Screenshot:

03.Insert values into the table item_info1.


Query: insert into item_info1 values(‘ABC101’,’SOAP’,’BATH
ROOM’,58,20);
Screenshot:

51
04.Display all the information of the table item_info1;
Query:select * from item_info1;
Screenshot:

05.Add primary key in the table using table constraint.


Query: alter table item_info1 add primary key(icode)
Screenshot:

06.Update the value quantity based on the condition.


Query:Update item_info1 set Qua=40 where Item_name=’SOAP’;
Screenshot:

52
07.Change the structure of table by adding a new column
Type char(20)
Query:alter table item_info1 add type char(20);
Screenshot:

08. To display a report, showing item information with icode in descending


order.
Query:select * from item_info1 order by icodedesc;

Screenshot:

53
09.Show all the information about the “laptop” ;
Query: select * from item_info1 where item_name=’LAPTOP’;
Screenshot:

10.Display all information whose name starts with ‘la’.


Query:select * from item_info1 where item_name like ‘la%’;

Screenshot:

11.Count the records of table item_info;


Query: select count(* ) from item_info1;
Screenshot:

54
12.Show maximum price of the item_info1 table.
Query:select max(price) from item_info1;

Screenshot:

13.Display the sum of all prices.


Query: select sum (price) from item_info1;

Screenshot:

14. Display the minimum quantity of the table.


Query: select * from min (Qua) form item_info1;

Screenshot:

15.Increase price of item by 10%(table item_info).


Query: update item_info1 set price=price+price*0.10;

55
Screenshot:

16.Display the distinct item price of the table item_info1.


Query:select distinct(price) from item_info1;
Screenshot:

17.Display the information according to given list of price using a list(using


IN operator)
Query:select * from item_info1 where price IN(275,500,250);

56
Screenshot:

18.View structure of the table


Query: desc item_info1;
Screenshot:

19.Delete the information of “Books”.


Query: select * from item_info1 where item_name=’Books’;
Screenshot:

20.Display the information of the item code “ABC104”.


Query:select * from item_info1 where icode=’ABC104’;

57
Screenshot:

21.Display the information whose price is between 100 to 1000.


Query: select * from item_info1 where price between 100 and 1000;

Screenshot:

22.Remove the primary key constraint from the table.


Query: alter table item_info1 drop primary key;

Screenshot:

23.Delete table item_info1 and its structure


Query: delete from item_info1;

58
Screenshot:

24.Drop the database.


Query: drop database sys;

Screenshot:

Bibliography
We took the information for our practical
report from the following sources:
59
Reference books:
1. Informatics Practices by Sumita
Arora.
2. Complete reference with Python
3. Data Analysis-Python.

Websites…
www.google.com
www.python.org.in

60

You might also like