You are on page 1of 9

PRACTICAL FILE

SESSION: 2023-24
CLASS - XII
INFORMATICS PRACTICES
(065)
(PYTHON / MYSQL)

Submitted By: Submitted to:


Name: Mr.________________

Roll No. PGT (Computer Science)

Acknowledgement
Certificate

INDEX
S. No. Practical Date Remarks

Write a program in python to create a series Ser1 of numeric data


with labels as a,b,c,d,e. Then create a new series object Ser2, contains
1. squares of each values from Ser1. Display Ser2 values which are
greater than 15.

Write a program in python to update the following series by writing


code for question (i) to (iv)

Kiran 33

Manvendra 48

Saswati NaN

1. Yash 43

(i) Add a new student Dev with marks 40

(ii) Fill all missing values by 0.

(iii) Update marks of Manvendra and Saswati by 44.


(iv) Display all information of Yash and Manvendra. (First display
Yash then Manvendra)

Write a program in python to create a dataframe fruits from following


data and answer the questions (i) to (v):

Color Count Price

Orange Yellow 30 40

Orange Green 19 30

Mango Yellow 25 60

Mango Green 29 120


1.
Pear Green 65 150

(i) Add a new column ‘Variety’ contains data as ‘Normal’, ‘Normal’,


‘Dashari’, ‘Hafooj’, ‘Normal’

(ii) Add a new row ‘Apple’ containing Red, 40, 190, Kashmiri.

(iii) Display price of all fruits.

(iv) Display color and price of all fruits.

(v) Display count to variety all columns.

Consider the following data and write python code for points (i) to (v)

Color Count Price

Orange Yellow 30 40

Orange Green 19 30

Mango Yellow 25 60
1.
Mango Green 29 120

Pear Green 65 150

(i) Write code to create a dataframe fruits using list of dictionaries.

(ii) Write code to display following attributes of dataframe- Index,


Columns, axes, datatype, no. of elements, dimensions, data in numpy,
check empty dataframe, no. of axes, transpose

Id name m1 m2 m3 m4

1Juvaraj Singh 54 14 30 34

2 Virat Kohli 48 37 21 25

3 Rohit Sharma 40 42 38 34
4 Sikhar Dhavan 42 13 34 30

1. 5 Dinesh Kartik 15 10 28 64

(i)To display the minimum valued of m1.

(ii)To display the first and second row values.

(iii) To remove the m4 column from the dataframe.

(iv) To add a new column total which is the summation of


(m1,m2,m3,m4)

(v) Write code to transpose the dataframe

Consider the following data frame of classes –

1. Write code to display the details of teacher(s), having highest number


of gradeA students and lowest number of gradeA students. (2 from
top and 2 from bottom)

Write a program to create a the following dataframe and answer the


questions (i) to (xv)-

Datafrme name : Covid_df

Name Masks Gloves Amount

SMS 30000 80000 2700000

AIIMS 50000 1500000 4200000

SDMH 10000 500000 200000

FORTIS 15000 5000 150000

SDMH 35000 30000 2500000

(i) Display number of masks bought by SMS.

(ii) Display amount paid by all hospitals.

(iii) Display amount paid by AIIMS and SMS in same sequence.


1. (iv) Display masks bought by Fortis

(v) Display all details of Fortis hospital.

(vi) Display total gloves bought by AIIMS using index only.

(vii) Find all rows with label ‘SDMH’ with all columns.

(viii) Find hospital paid amount more than 200000.


(ix) List single True or False to signify if all amount more than
200000 or not.

(x) List 2nd , 3rd and 4th rows.

(xi) List only the columns Masks and Amount.

(xii) List columns 0 to 1 .

(xiii) List only rows with labels AIIMS and FORTIS

(xiv) List only rows 0,2,3

(xv) Display data of rows AIIMS, SDMH and columns Masks and
Gloves
Write a program to create a the following dataframe and answer the
questions (i) to (v)-

Datafrme name : Covid_df

Name Masks Gloves Amount

SMS 30000 80000 2700000

AIIMS 50000 1500000 4200000

SDMH 10000 500000 200000

1. FORTIS 15000 5000 150000

SDMH 35000 30000 2500000

(i) Add new row as: SHALBY 5000 20000 150000

(ii) Add a column as Remarks with data -> Paid, Pending,Paid,


Paid,Pending, Paid

(iii) Remove rows labelled as SMS and FORTIS.

(iv) Update remarks of AIIMS as Paid.

(v) Remove columns Amount and Remarks.

Write a program to create a line chart for following data-

x=[2,4,3,7,5]

y=[23,43,18,20,5]

1. Write code to

(a) Display dashed line

(b) Display + (plus) marker

(c )Change the marker color to blue


Write a program to plot a bar chart in python to display the result of
a school for five consecutive years.

1. (a) Change the colour bars in sequence as red,yellow,green,blue,cyan

(b) Change width of bars in sequence as 0.5,0.6,0.7,0.8,0.9

Write a program to create multiple line charts on common plot where


three data ranges are plotted on the same chart.

The data ranges to be plotted are-

DATA = [[5.,42.,28.,18.],[9.,13.,22.,29.],[8.,32.,26.,40.]]
1.
(i) Display legends as Range1,Range2 and Range3.

(ii) Display label on x and y axes as X and Y respectively.

(iii) Add title as “Multirange line chart”

Write a program to create the histogram for (a) to (g). The data is
given below-

Weight measurements for 16 small orders of French Fries (in grams).

78 72 69 81 63 67 65 73

79 74 71 83 71 79 80 69

1. (a) Create a simple histogram from above data.

(b) Create a horizontal histogram from above data. [Hint:


orientation='horizontal')]

(c) Create a step type of histogram from above data.[Hint:


histtype='step']

(d) Create a cumulative histogram from above data. [Hint:


cumulative=True]

Write a Python-MySQL Connectivity code to perform the following


operation with School Database Employee Table.

Operations:

1. 1. Add New Employee Record


2. Display Existing Employee Details in Tabulation form
3. Update employee information with employee id
4. Remove existing by Employee id and show appropriate message in case
record not exist.
5. Search Employee record by Employee Name
Write a Python-MySQL Connectivity code to perform the following
operation with “Bill” Database Inventory Table.

1. Operations:

1. Make Entry of New Goods [ItemNo, Iname, Price, Quantity,


Make]
2. Print Status of Stock
3. Modify Regular Selling Item Stock.
4. Search Item with Name of Item.

Table: EMPLOYEES

Table: EMPSALARY

Give the Output of following SQL commands:

(i) Select Employee.firstname, empsalary, salary from employees,


empsalary where designation = ‘Salesman’ and
Employees.empid=Empsalary.empid;
1.
(ii) Select count(distinct designation) from empsalary;

(iii) Select designation, sum(salary) from empsalary group by designation


having count(*) >2;

(iv) Select sum(benefits) from empsalary where designation =’Clerk’;

v) Write SQL Query for Equi join and Non-equi join.

Write a query to create the following table with Show structure of


Table and Number of Tables in Current working Database. Table –
1. Customer

A Stationery shop MyBag has decided to maintain its inventory of


items using MySQL. As a database administer, Rahul has created the
database and table as per the following :

Name of the database -MyBag

Name of the table - ITEMS


1.
The attributes of ITEMS are as follows: ItemNo – Numeric,
ItemName – Character of size 20 ,Scode –Numeric,Quantity –
Numeric

Table: ITEMS

A music store MySports is considering to maintain their inventory


using SQL to store the data. The detail is as follow: Name of the
database – MySports, Name of the table – Sports
The attributes of SPORTS are as follows:
1.
SCode – character
SportName – character of size 20
Noofplayers – numeric
coachname – character of size 20

Table: SPORTS

Table: SPORTS

a) Create Table “SPORTS”

b) Display details about structure of table.

1. c) Insert the following data into the attributes SCode, SportName and
No. of players respectively in the given table SPORTS.

SCode = S007, SportName = “Kabbadi” and Noofplayers = 15

d) To delete Column “ SCode” and Another Column “SID” with


appropriate column type and constraints.

Practical-1
Write a program in python to create a series Ser1 of numeric data with labels as a,b,c,d,e. Then create a
new series object Ser2, contains squares of each values from Ser1. Display Ser2 values which are greater
than 15.

Sol.

L=[1,2,3,4,5]

import pandas as pd

Ser1=pd.Series(L,index=['a','b','c','d','e'])

print(Ser1)

Ser2=Ser1**2

print(Ser2[Ser2>15])

Output:

a 1
b 2
c 3
d 4
e 5
dtype: int64
d 16
e 25
dtype: int64

****************** Best of Luck ***************


Conclusion

Bibliography

KENDRIYA
VIDYALAYA NO.1
SAMBALPUR

You might also like