Ip Class 12 Practical File
Ip Class 12 Practical File
PRACTICALPROGRAMS
GRADE–XII
[2025-2026]
Preparedby:
Mr.Aashif Khan
1
PGT:IP/CS
TABLEOFCONTENTS
S.No Name of the Exercises Page.No
Programs using Pandas
SERIES
1. Creating a Python program to create a series using a dictionary. 3
2. Creating a Python program to create a series using scalar value. 4
3. Creating a Python program to create a series using numpy array. 5
4. Creating a python program for modifying or updating existing values of series 6
object.
5. Creating a Python program for performing mathematical operations on two 7
Series objects.
6. Creating a Python program for calculating per capita income of four zones 8
Using Series.
7. Creating a Python program to display attribute sofa Series. 9
8. Creating a Python program using head() and tail() in Series. 10
DATAFRAME
9. Creating a Python program for creating a Data Frame using a nested list. 11
10. Creating a Python program for creating a Data Frame using a dictionary of 12
lists.
11. Creating a Python program for accessing values of rows and column sofa 14
Data Frame.
12. Creating a python program to perform operations on a DataFrame(rename, 16
Count ,update ,replace)
13. Creating a Python program to filter the data of a Data Frame. 18
14. Creating a Python program to display the attributes of the DataFrame. 19
15. Creating a Python program to display the data of a DataFrame row-wise and 20
column-wise using iterrows() and iteritems()
16. Creating a Python program to perform writing and reading operations in a 22
CSV file.
ProgramsusingMatplotlib–DataVisualization
17. Creating a python program for plotting a line chart. 23
18. Creating a python program for plotting a bar chart from a CSV file. 24
19. Creating a python program for plotting a multiple bar chart from a CSV file. 25
20. Creating a python program for plotting Histogram. 26
SQLQueries
21. SQL COMMANDS EXERCISE–1(Basic Queries–I) 27
22. SQL COMMANDS EXERCISE–2(Basic Queries–II) 29
23. SQL COMMANDS EXERCISE–3(Aggregate functions, Order by Group by, 31
Having Clause)
24. SQL COMMANDS EXERCISE–4(Math Functions) 33
25. SQL COMMANDS EXERCISE–5(Text Functions) 35
26. SQL COMMANDS EXERCISE–6(Date Functions) 37
2
EX.NO:1
To write a Python program to create a Series to store 5 students Percentage Using dictionary
and print all the elements that are above 75 percentage.
SOURCE CODE:
SAMPLE OUTPUT:
************************************************************************************************
3
EX.NO:2
CREATING A PYTHON PROGRAM TO CREATE
ASERIES USING SCALAR VALUE
To write a Python 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.
SOURCE CODE:
SAMPLE OUPUT:
4
EX.NO:3
CREATING A PYTHON PROGRAM TO CREATE
ASERIES USING NUMPY ARRAY
To write a Python program to create a Series object that stores the Employee names as
index and their Salary as values
SOURCECODE:
SAMPLEOUTPUT:
*************************************************************************************************
5
EX.NO:4
To Write a Python program to create a Series object with Employee names as the index and
their salaries as values. Accept the name of the employee whose salary needs to be changed,
along with the new salary, and update it in the Series.
SourceCode:
SampleOutput:
****************************************************************************************
6
EX.NO:5
PERFORMING MATHEMATICAL OPERATIONS ON SERIES OBJECTS
SOURCECODE:
SAMPLEOUTPUT:
**************************************************************************************************
7
EX.NO:6
To write a Python program to create two series i.e. population and average
income of Four Zones, and then calculate per capita income storing in third
pandas series print it.
SourceCode:
SampleOutput:
***************************************************************************************
8
EX.NO:7
To write a Python program to create a Series using list and display the following attributes of the
Series: (i) index(ii) dtype(iii) size(iv) shape (v) hasnans
SOURCECODE:
SAMPLEOUTPUT:
*************************************************************************************************
9
EX.NO:8
To write a Python program to create a Series using list of Marks of 10 students and
Display first 5 Students’ marks and Last2 Students’ marks from Series object.
SOURCECODE:
SAMPLEOUTPUT:
**************************************************************************************************
10
EX.NO:9
To write a Python program to create a panda’s DataFrame for the following table Using
Nested list:
SOURCECODE:
SAMPLEOUTPUT:
**************************************************************************************************
11
EX.NO:10
DATAFRAME
To write a Python program to create a panda’s DataFrame called DF for the following
Table Using Dictionary of List and perform the following operations:
SOURCECODE:
12
SAMPLEOUTPUT:
*************************************************************************************************
13
EX.NO:11
To write a Python program to create a panda’s DataFrame called DF for the following
Table Using Dictionary of List and perform the following operations:
SOURCECODE:
14
SAMPLEOUTPUT:
**************************************************************************************************
15
EX.NO:12
16
SampleOutput:
*************************************************************************************
17
EX.NO:13
CREATINGAPYTHONPROGRAMTOFILTERTHEDATAOFADATAFRAME
To write a Python program to create a panda’s DataFrame called DF for the following table
using Dictionary of List and display the details of students whose Percentage is more than 85.
SOURCECODE:
SAMPLEOUTPUT:
*******************************************************************************************
18
EX.NO:14
To write a Python program to create a DataFrame using Dictionary of list and display the
following attributes of the DataFrame: (i)index (ii)columns (iii)axes (iv)dtypes
(v)shape (vi)dimension (vii)T
SOURCECODE:
SAMPLEOUTPUT:
*******************************************************************************************
19
EX.NO:15
To write a Python program to create a panda’s DataFrame called Students for the
Following table and demonstrate iterrows and iteritems.
SOURCECODE:
20
SAMPLEOUTPUT:
#OutputforIterrows() #OutputforIteritems()
**********************************************************************************************
21
EX.NO:16
To Write a Python program to store the details of Employess’ such as Empno, Name,
Salary into a Employee.csv file. Also, write a code to read employee details from csv
file.
SOURCECODE:
SAMPLEOUTPUT:
**********************************************************************************************
22
EX.NO:17
CREATINGAPYTHONPROGRAMFORPLOTTINGALINECHART
To write a Python program to plot a Linechart to depict the changing weekly Onion
And Brinjal prices for four weeks. Also, give appropriate axes labels, title and keep marker style
as Diamond and marker edgecolor as ‘red’ for Onion.
SOURCE CODE:
SAMPLEOUTPUT:
*********************************************************************************************
23
EX.NO:18
SourceCode:
SampleOutput:
***********************************************************************************************
24
EX.NO:19
To write a Python program to plot a multiple bar chart From CSV file using Matplotlib
for subject wise Scores ofClass A, ClassB, and Class C. Different colors represent each
class, and subjects include English, Accountancy, Economics, BST and IP. Proper
labels, a title and a legend are displayed on the chart.
SourceCode:
SampleOutput:
*****************************************************************************************************
25
EX.NO:20
To write a Python program to plot a Histogram for the following class interval or range. Also,
give appropriate axes name, title and edege color as ‘red’.
SOURCECODE:
SAMPLEOUTPUT:
******************************************************************************************
26
Ex.No:21
To write Queries for the following Questions based on the given table:
USE EMPS;
27
(e) Write a Query to List all the tables that exists in the current database.
SHOW TABLES;
Output:
(f) Write a Query to insert all the rows of above table into Info table.
(g) Write a Query to display all the details of the Employees from the above table 'INFO'.
Output:
****************************************************************************************************
28
Ex.No:22
SQLCOMMANDSEXERCISE–2
(BasicQueries–II)
To write Queries for the following Questions based on the given table:
(a) Write a Query to Display Employees’ name and City from the above table.
Output:
(b) Write a Query to Display all details of Employees who are living in Chennai.
Output:
29
(c) Write a Query to get the name and salary of the employee whose salary is above
15000 and gender is not male.
(d) Write a query to update increase 10% Salary of an employee whose City is'CHENNAI'
and Gender is 'MALE'.
Output(AfterUpdating):
Output(After Deletion):
30
*************************************************************************
31
Ex.No:23
SQL COMMANDS EXERCISE–3
To write Queries for the following Questions based on the given table:
Output:
Output:
Output:
31
(d) Write a Query to count the number of employees earning more than 25000.
Output:
(e) Write a query to display sum of salary of the employees grouped by department wise.
(f) Write a query to display the department names where number of employees are
greater than or equal to 2.
Output:
****************************************************************************************
32
Ex.No:
To write Queries for the following Questions based on the given table-"STU":
(a) Write a Query to Display square of age that got admission in the month of August.
Output:
33
(c) Write a Query to display Student names and their Percentage in round figure.
Output:
(d) Display Name, Percentage and round up the remainder marks up to 2 decimal
places.
Output:
**************************************************************************************
34
Ex.No:25
SQLCOMMANDSEXERCISE–5
(TextFunctions)
To write Queries for the following Questions based on the given table-"STU":
Output:
(b) Write a Query to display department name and its respective number of characters in
Dept column.
35
(c) Write a Query to display first 2characters of the column Name.
Output:
(e) Write a query to display the names of all students and extract five characters from
the third position of the 'Name' field.
Output:
**********************************************************************************************
36
Ex.No:26
To write Queries for the following Questions based on the given table:
(a) Write a Query to display student name and month of date of admission of all
students.
(b) Write a Query to display Student name and day name of the students’ DOA of the
Table STU.
37
(c) Write a query to display the joining year of IP students.
Output:
(d) Write a Query to Display the month for the date_of_birth of all students.
Output:
(e) Write a query to display the names of the students who joined in the month of June.
*********************************************************************************************
38