Class 12 Ip Practical Programs 2024-25
Class 12 Ip Practical Programs 2024-25
Class 12 Ip Practical Programs 2024-25
(065)
PRACTICAL PROGRAMS
Session :2024-25
Class :12th (A/B/C)
GRADE –
XII [2024-
2025]
TABLE OF CONTENTS
S.No Name of the Exercises Page.No
Programs using Pandas
SERIES
1. Creating a Python program to create a series using a dictionary.
2. Creating a Python program to create a series using scalar value.
3. Creating a Python program to create a series using NumPy array.
4. Creating a python program for modifying or updating existing values of series
object.
5. Creating a Python program for performing mathematical operations on two
Series objects.
6. Creating a Python program for calculating per capita income of four zones
using Series.
7. Creating a Python program to display attributes of a Series.
8. Creating a Python program using head() and tail() in Series.
9. Create a series of these numbers: 33,55,65,29,19,23. Find the sum of those values which
are ending with 3 or 5.
DATAFRAME
10 Creating a Python program for creating a DataFrame using a nested list.
11. Creating a python program for accessing values of rows and columns of a
dataframe.
12. Creating a Python program for accessing values of rows and columns of a
DataFrame.
13. Creating a python program to perform operations on a DataFrame (rename,
count, update, replace)
14. Creating a Python program to filter the data of a DataFrame.
15. Creating a Python program to display the attributes of the DataFrame.
16. Creating a Python program to display the data of a DataFrame row-wise and
column-wise using iterrows() and iteritems()
17. Creating a Python program to perform writing and reading operations in a
CSV file.
DATA VISUALIZATION
18. Creating a python program for plotting a line chart.
19. Creating a python program for plotting a bar chart from a CSV file.
20. Creating a python program for plotting a multiple bar chart from a CSV file.
21. Creating a python program for plotting Histogram.
22. Consider the following data of a medical store and plot the data on the line chart and
Customize the chart as you wish:
Month Masks Sanitizer Hand wash
March 1500 4400 6500
April 3500 4500 5000
May 6500 5500 5800
June 6700 6000 6300
July 6000 5600 6200
August 6800 6300 4500
SQL
2
23. SQL COMMANDS EXERCISE – 1 (Basic Queries – I)
24. SQL COMMANDS EXERCISE – 2 (Basic Queries – II)
25. SQL COMMANDS EXERCISE – 3 (Aggregate functions, Order by Group by,
Having Clause)
26. SQL COMMANDS EXERCISE – 4 (Math Functions)
27. SQL COMMANDS EXERCISE – 5 (Text Functions)
28. SQL COMMANDS EXERCISE – 6 (Date Functions)
3
CREATING A PYTHON PROGRAM TO CREATE A
SERIES USING A DICTIONARY.
AIM:
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:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
SAMPLE OUTPUT:
************************************************************************************************
4
CREATING A PYTHON PROGRAM TO CREATE A
SERIES USING SCALAR VALUE
AIM:
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:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
SAMPLE OUPUT:
4
CREATING A PYTHON PROGRAM TO CREATE A
SERIES USING NUMPY ARRAY
AIM:
To write a Python program to create a Series object that stores the Employee names
as index and their Salary as values
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
SAMPLE OUTPUT:
*************************************************************************************************
5
CREATING A PYTHON PROGRAM FOR MODIFYING OR UPDATING EXISTING VALUES
OF SERIES OBJECT.
AIM:
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.
Source Code:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
Sample Output:
****************************************************************************************
6
CREATING A PYTHON PROGRAM FOR PERFORMING MATHEMATICAL
OPERATIONS ON TWO SERIES OBJECTS
AIM:
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
SAMPLE OUTPUT:
**************************************************************************************************
7
CREATING A PYTHON PROGRAM FOR CALCULATING PER CAPITA INCOME OF
FOUR ZONES USING SERIES
AIM:
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.
Source Code:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
Sample Output:
***************************************************************************************
8
CREATING A PYTHON PROGRAM TO DISPLAY ATTRIBUTES OF A SERIES
AIM:
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
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
SAMPLE OUTPUT:
*************************************************************************************************
9
CREATING A PYTHON PROGRAM USING head() AND tail() IN SERIES
AIM:
To write a Python program to create a Series using list of Marks of 10 students and
display first 5 Students’ marks and Last 2 Students’ marks from Series object.
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
SAMPLE OUTPUT:
**************************************************************************************************
10
EX:10
. Aim: Create a series of these numbers:
33,55,65,29,19,23.
Find the sum of those values which are ending with 3 or 5.
Source Code:
import pandas as pd
list = [33,55,65,29,19,23]
ser = pd.Series(list)
val_sum = 0
sum5 = sum(ser[ser % 10 == 5])
sum3 = sum(ser[ser % 10 == 3])
print(sum3+sum5)
OUTPUT:
176
11
CREATING A PYTHON PROGRAM FOR CREATING A DATAFRAME USING A
NESTED LIST
AIM:
To write a Python program to create a panda’s Data Frame for the following table Using
Nested list:
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
SAMPLE OUTPUT:
**************************************************************************************************
12
CREATING A PYTHON PROGRAM FOR ACCESSING VALUES OF ROWS AND
COLUMNS OF A DATAFRAME
AIM:
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:
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
13
SAMPLE OUTPUT:
*************************************************************************************************
14
CREATING A PYTHON PROGRAM FOR ACCESSING VALUES OF ROWS AND COLUMNS
OF A DATAFRAME
AIM:
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:
(i) Insert a new column “Bags” with values as [5891, 8628, 9785, 4475].
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
15
SAMPLE OUTPUT:
**************************************************************************************************
16
CREATING A PYTHON PROGRAM TO PERFORM OPERATIONS ON A DATAFRAME
(RENAME, COUNT, UPDATE, REPLACE)
AIM:
To write a Python program to create a pandas DataFrame to analyze number of
Government and Private medical college and their Total seats,Fees statewise details
using the dataset available at www.data.gov.in. Also, perform the following
operations.
(i) To Change the name of the state AP to Andhra.
(ii) To Count and Display Non-NaN values of each column.
(iii) To Count and Display Non-NaN values of each row.
(iv) To Increase the fees of all colleges by 5%
(v) To Replace all NaN values with 0.
Source Code:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
17
Sample Output:
*************************************************************************************
18
CREATING A PYTHON PROGRAM TO FILTER THE DATA OF A DATAFRAME
AIM:
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.
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
SAMPLE OUTPUT:
*******************************************************************************************
19
CREATING A PYTHON PROGRAM TO DISPLAY THE ATTRIBUTES OF A
DATAFRAME
AIM:
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
SOURCE CODE:
RESULT:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
20
*******************************************************************************************
21
CREATING A PYTHON PROGRAM TO DISPLAY THE DATA OF A DATAFRAME
ROW-WISE AND COLUMN-WISE USING ITERROWS() AND ITERITEMS()
AIM:
To write a Python program to create a panda’s DataFrame called Students for the
following table and demonstrate iterrows and iteritems.
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
22
SAMPLE OUTPUT:
**********************************************************************************************
23
CREATING A PYTHON PROGRAM TO PERFORM WRITING AND READING OPERATIONS
IN A CSV FILE
AIM:
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.
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed successfully, and the output has
been verified.
SAMPLE OUTPUT:
**********************************************************************************************
24
CREATING A PYTHON PROGRAM FOR PLOTTING A LINE CHART
AIM:
To write a Python program to plot a Line chart 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 edge color as ‘red’ for Onion.
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed and verified successfully, and its
respective chart has been generated successfully.
SAMPLE OUTPUT:
*********************************************************************************************
25
CREATING A PYTHON PROGRAM FOR PLOTTING A BAR CHART
FROM A CSV FILE
AIM:
To write a Python program to create a DataFrame for subject-wise average, save it to
a CSV file, and then draw a bar chart using Matplotlib with a width of each bar as 0.25,
specifying different colors for each bar. Additionally, provide a proper title and axes labels
for the bar chart.
Source Code:
RESULT:
Thus, the above Python program has been executed and verified successfully, and its
respective chart has been generated successfully.
Sample Output:
***********************************************************************************************
26
CREATING A PYTHON PROGRAM FOR PLOTTING A MULTIPLE
BAR CHART FROM A CSV FILE
AIM:
To write a Python program to plot a multiple bar chart From CSV file using Matplotlib
for subject wise Scores of Class A, Class B, 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.
Source Code:
RESULT:
Thus, the above Python program has been executed and verified successfully, and its
respective chart has been generated successfully.
Sample Output:
27
*****************************************************************************************************
28
EX.NO: 29
DATE:
29
SOURCE CODE:
RESULT:
Thus, the above Python program has been executed and verified successfully, and the
respective chart has been generated successfully.
SAMPLE OUTPUT:
SQL COMMANDS EXERCISE – 1
(Basic Queries – I)
AIM:
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
DATE:
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'.
*************************************************************************
30
Ex.No: 23
DATE:
SQL COMMANDS EXERCISE – 3
Output:
Output:
(c) Write a Query to display maximum salary and minimum salary of employees.
SELECT MAX(SALARY), MIN(SALARY) FROM INFO;
Output:
31
(d) Write a Query to count the number of employees earning more than 25000.
(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: 24
DATE:
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
DATE:
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.
Output:
35
(c) Write a Query to display first 2 characters 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
DATE:
(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.
Output:
37
(c) Write a query to display the joining year of IP students.
SELECT YEAR(DOA) FROM STU WHERE DEPT='IP'
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