0% found this document useful (0 votes)
6 views10 pages

Python Pandas and MySQL Queries (Practical File) (2025 - 2026)

The document outlines a practical journal for Class XII (IP) for the academic year 2025-2026, focusing on MySQL queries and Python Pandas programs. It includes SQL commands for database creation, table management, data insertion, and various query requirements. Additionally, it covers a range of Python programming tasks related to data manipulation and visualization using Pandas.

Uploaded by

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

Python Pandas and MySQL Queries (Practical File) (2025 - 2026)

The document outlines a practical journal for Class XII (IP) for the academic year 2025-2026, focusing on MySQL queries and Python Pandas programs. It includes SQL commands for database creation, table management, data insertion, and various query requirements. Additionally, it covers a range of Python programming tasks related to data manipulation and visualization using Pandas.

Uploaded by

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

PRACTICAL JOURNAL for Class - XII (IP)

(Year: 2025  2026)


1 MySQL Queries
create database stream_of_students;

use stream_of_students;

create table stream


(s_code char(4) primary key,
s_name varchar(15) unique,
annual_fees float(8, 2) not null);

desc stream;

insert into stream values


('S001', 'Science', 120000),
('S002', 'Commerce', 90000),
('S003', 'Humanities', 75000);

select * from stream;

create table students


(AdmNo int(4) primary key,
stud_name varchar(30) unique,
adm_date date not null,
birthcity varchar(15) not null default 'Vadodara',
gender char(6) not null check (gender in ('Male', 'Female')),
fees_paid float(8, 2), concession float(8, 2),
str_code char(4));
alter table students add foreign key (str_code)
references stream(s_code) on delete cascade on update cascade;

desc students;

insert into students values


(803, 'Virat Sharma', '2025-03-24', 'Surat', 'Male', 60000, null, 'S002'),
(1104, 'Naman Patil', '2025-05-01', 'Rajkot', 'Male', 50000, 5000, 'S001'),
(947, 'Anita Shah', '2025-04-11', 'Bhavnagar', 'Female', 50000, null, 'S003'),
(1008, 'Rahul Patel', '2025-02-01', 'Anand', 'Male', 67000, 8000, 'S003'),
(991, 'Niraj Dave', '2025-05-21', 'Vadodara', 'Male', 45000, 5000, 'S001'),
(467, 'Tanvi Ozha', '2025-04-10', 'Surat', 'Female', 50000, null, 'S003'),
(451, 'Indrajeet Pandit', '2025-06-02', 'Ahmedabad', 'Male', 40000, null, 'S003'),
(890, 'Roshani Yadav', '2025-06-07', 'Surendranagar', 'Female', 80000, null, 'S001'),
(1032, 'Bhavesh Sharma', '2025-02-28', 'Ahmedabad', 'Male', null, 10000, 'S003'),
(267, 'Jay Gandhi', '2025-05-30', 'Surat', 'Male', 65000, 5000, 'S002'),
(349, 'Karishma Patil', '2025-01-30', 'Ahmedabad', 'Female', 90000, 10000, 'S001'),
(666, 'Mohan Shah', '2025-02-19', 'Rajkot', 'Male', 50000, 10000, 'S001'),
(1080, 'Ajay Trivedi', '2025-06-20', 'Bhavnagar', 'Male', 60000, 10000, 'S001'),
(1111, 'Nidhi Tiwari', '2025-06-09', 'Vadodara', 'Female', 50000, null, 'S001'),
(945, 'Radha Shastri', '2025-03-31', 'Anand', 'Female', 70000, null, 'S002'),
(1088, 'Ganesh Dave', '2025-01-28', 'Jamnagar', 'Male', 50000, 5000, 'S002'),
(791, 'Manisha Shah', '2025-03-18', 'Anand', 'Female', null, 10000, 'S002'),
(567, 'Harsha Malhotra', '2025-05-24', 'Surendranagar', 'Female', 90000, null, 'S002'),
(698, 'Yogesh Pandit', '2025-05-30', 'Vadodara', 'Male', 60000, 5000, 'S002'),
(1105, 'Ram Dave', '2025-04-19', 'Jamnagar', 'Male', 40000, null, 'S003');
select * from students;

Write SQL commands for the following statements:


(A) To display student’s name, birthcity, fees_paid and concession with birthcitywise
ascending order.
(B) To display student’s name, admission date and stream name with stream code-
wise ascending order.
(C) To display Male condidates having birthcity is Vadodara.
(D) To display students having surname is Shah.
(E) To display students having student’s name begins with character ‘R’.
(F) To display student’s name, admission date, fee_paid between 50000 to 75000.
(G) To display female candidates from Vadodara, Surat and Anand Cities.
(H) To display student’s information having fees_paid or concession is NULL.
(I) To display information birthcitywise, genderwise number of students.
(J) To display Streamwise, genderwise number of students.
(K) To display number of students from birthcity more or equal to 3.
(L) To display admission number, student’s name, admission date and stream code
having taking admission in ‘May’ month.
(M) To display admission number, student’s name, admission date and stream code
having taking admission on ‘Saturday’.
(N) To display Admission Number, Student Name with received fees.
(Received Fees  fees_paid – concession)
(O) To display AdmNo, student's name, stream and Pending Fees.
(Pending Fees  Annual_Fees - Fees_Paid - Concession)
List of Python Pandas Programs
2 Create a following Series. 3 Create a following Series using
arange() function.

4 Create a following Series using arange() 5 Create a following Series using


function. linspace() function.

6 Create a following Series using linspace() 7 Create a following Series and display
function. all attributes.

8 Create a following Series using Python 9 Create a following Series and change
Dictionary. the different index and datatype.

10 Apply all the attributes of following 11 Prepare a Series object of following


Series Object. data:
[5, 8, 11, 14, 17, 20, 23, 26, 29, 32,
35, 38, 41, 44, 47, 50, 53, 56, 59, 62,
65, 68]
Display the output with following
slices:
(a) [3: 22: 3]
(b) [0: 13: 2]
(c) [-4: -18: -2]
12 Prepare a Series object (V) of following 13 Create a following Series and show
data: the use of sort_values() and
[4, 90, 11, 25, 17, 35, 15, 70, 3, 44, 95, 7, sort_index().
9, 62, 18, 27, 80, 20, 100, 55]
Display the output with following
conditional values:
(a) V[V>=70]
(b) V[(V>=30) & (V<=75)]
(c) V[(V%7==0) | (V%10==0)]
14

Create above DataFrame object from


(Method - 1) a 2-D dictionary.
(Method - 2) a list of dictionaries / lists
(Method - 3) a 2-D ndarray
(Method - 4) a 2-D dictionary with values as Series Objects
15 Create a following DataFrame and display all the attributes.

16 Create a following DataFrame and fetching Single and Multiple columns from a
DataFrame (A).

(1) fetching information for Single column like "Student Name".


(2) fetching information for multiple columns as 'Gender' and 'Student Name'.
17 Create a following DataFrame and conditional values displaying.
Name of DataFrame: K

(1) display rows with only 'Female' candidates.


(2) display 'Male' candidates with Science Stream.
(3) display candidates having TestResult >= 40.
(4) display candidates having TestResult between 30 and 40.
18 Create a following DataFrame and fetching Single and Multiple row(s) / column(s)
from a DataFrame (A) using loc() function.

(1) fetching information for multiple rows based on index 'c' to 'g'.
(2) fetching information for multiple rows 'c' to 'g'
& columns 'Student Name' and 'Gender'.
(3) specific rows like 'a', 'd', 'g' & columns 'Student Name' and 'Gender'.
(4) specific columns like "Student Name", 'Age' and all rows.
19 (1) Add new column ‘City’ with different Indian cities for each row.
(2) Add a new row with suitable values.
(Consider DataFrame of Question No. 13)
20 (1) Drop a single column and multiple columns using del statement & drop function.
(2) Delete multiple rows from a DataFrame.
(Consider DataFrame of Question No. 16)
21 Consider the following DataFrame Students:
RollNo Name BloodGroup
A01 1 Pradeep O+
A02 2 Sanjay AB+
A03 3 Mahesh B-
A04 4 Praveen A+
Write commands to:
(i) Add a new column ‘BirthCity’ to the DataFrame Students. (Any Indian City)
(ii) Add a new row with index = ‘A10’ and values (10, Kapil, O-, Mumbai)
(iii) Write python code to drop / delete column BloodGroup.
(iv) Write python statement to delete the row with index A03.
22 Chapter – 2: Example: 2 (Book Page No. 107 – 108)
23 Chapter – 2: Example: 3 (Book Page No. 109)
24 Chapter – 2: Practical Questions: Q. 16 (Book Page No. 152 – 153)
25 Chapter – 2: Practical Questions: Q. 17 (Book Page No. 153)
26 Write the Python code for preparing a Line chart as given below (without DataFrame):
Marker Color: Red
Marker: Circle
Marker Size: 10
Line Style: dash dot

X-ticks rotation: 450

27 Write the Python code for preparing a Line chart for the number of students in
Programming activity from each class (Without making a DataFrame).
 Give suitable title, x-axis label and y-axis label.
 Give y-ticks 2 to 22 with interval of 2.
 Line Color is ‘Red’ and marker type = “Circle”
 marker Size = 10, marker edge color = “Black”.
 Line Style is ‘dashed’.
 Chart’s grid is true.
Classes VIII IX X XI XII
Students in Programming activity 5 8 6 18 12
28 Write the Python code for preparing a Bar chart for the Cash contribution for Blood
Donation Camp of Class – XII students (Without making a DataFrame).
 Give suitable title, x-axis label and y-axis label.
 Give y-limit range between 4000 to 9500.
 Give y-ticks 4000 to 9500 with interval of 1000.
 Bar Color is ‘Red’ and Bar width = 0.7.
 Chart’s grid is true.
Name of Student Ajit Nayan Om Raj Seema Jaya
Cash Contribution 8000 6000 5000 8000 7000 9000
29 Write the Python code for preparing a Bar chart as given below (without DataFrame):
Bar Colors:
Red, Green and Blue

Bar Width: 0.6

X-ticks rotation: 450

30 Prepare a multiple valued Bar Chart with following data (without DataFrame):
Name Ram Vijay Mohan Raj Jay Netra Radha Nirav
Sales-1 56 95 29 45 67 87 60 40
Sales-2 40 82 50 35 43 57 80 30

31 Prepare a multiple valued Bar Chart with following data (without DataFrame):
Name Ram Vijay Mohan Raj Jay Netra Radha Nirav
Sales-1 56 95 29 45 67 87 60 40
Sales-2 40 82 50 35 43 57 80 30
Sales-3 45 73 45 60 20 77 40 60
32 Prepare a Histogram Chart with following data (without DataFrame):
1, 1, 2, 3, 3, 5, 7, 8, 9, 10, 10, 11, 11, 13, 13, 15, 16, 17, 18, 18, 18, 19, 20, 21, 21, 23,
24, 24, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 27, 29, 30, 30, 31, 33, 34, 34, 34, 35,
36, 36, 37, 37, 38, 38, 39, 40, 41, 41, 42, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 51, 52,
53, 54, 55, 55, 56, 57, 58, 60, 61, 63, 64, 65, 66, 68, 70, 71, 72, 74, 75, 77, 81, 83, 84,
87, 89, 90, 90, 91.

33 Chapter – 3: Example: 29 (Book Page No. 217)


34 Prepare a Line Chart using following DataFrame object:

35 Prepare a Bar Chart using following DataFrame object:


36 Chapter – 4: Prepare a following .csv file in your suitable directory and prepare a
DataFrame object.

37 Chapter – 4: Prepare a following .csv file in your suitable directory and prepare a
DataFrame object without ‘|’ separator and column names Emp_No, Emp_Name,
Salary & Designation.

38 Chapter – 4: Example: 4 (Book Page No. 267)


39 Chapter – 4: Example: 8 (Book Page No. 269 – 270)
40 Chapter – 4: Prepare a following DataFrame:

and create a new .csv file, in your suitable directory.


41 Chapter – 4: Prepare a following DataFrame:

and create a new .csv file, in your suitable directory with proper text in place of NaN.

You might also like