XII IP - Practical Program Lists - Students

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

EMIRATES FUTURE INTERNATIONAL

ACADEMY

INFORMATICS PRACTICAL RECORD PROGRAM LIST 2021-22

DATA HANDLING – PYTHON PANDAS


1. Program to create and display a series of odd numbers 1, 3, 5, 7, 9, 11, 13, 15,
17, 19 with index.
2. Program To create and display a series of odd numbers 1, 3, 5, 7, 9, 11, 13, 15,
17, 19 with index value a, b, c, d, e, f, g, h, i, j using Pandas module. Also do
the following:
a. Display the first 4 index values.
b. Display the last 5 index values.
c. Display index 3,7 and 8.
d. Display the first five index values.
e. Display the index 4 to 8.
f. Display the index 6 to end.
g. Change the element in index 3 to 25
h. Delete the 5th element from the series.
3. Program to print all the elements that are above the 75th percentile.
4. Program to create a DataFrame quarterly sales where each row contains the
item category, item name, and expenditure. Group the rows by the category and
print the total expenditure per category.
5. Program to show the attributes of the DataFrame. [index,columns, values, axes,
dtype,shape,nbytes, ndim,size, hasnans, empty]
6. Program to filter out rows based on different criteria such as duplicate rows
7. Program to replace all missing values in a data frame with a 999.
8. Program to find highest, lowest, and mean of marks obtained by students
9. Program to import and export data between pandas and CSV file.
10. Python program to transfer the data from dataframe to mysql table
11. Python program to transfer the data from mysql to dataframe
DATA VISUALIZATION
12. Program to Analyse the performance of the students on different parameters for
the given school result data.
13. Program to plot multiple bar graph
14. Program to plot horizontal bar graph
15. Program to plot multiple line plot to visualize the spread of #covid-19.
16. Program to plot histogram to visualize the frequency of commuters in a
shopping mall.
17. Take data of your interest from an open source (e.g. data.gov.in), aggregate and
summarize it. Then plot it using different plotting functions of the Matplotlib.
SQL
18. SQL program - the use of DML commands:
Open MYSQL and Login with your ID and password. Writ e and Execute the
SQL command for the following:
a. Create a database named MYORG.
b. Open the database with USE command
c. Create a table name Emp wiith the following structure

Empno Ename Job Hiredate Salary Comm


Integer Varchar(30) Char(10) Date Integer Integer

d. Insert the following Records:-


Empno Ename Job Hiredate Salary Comm
8369 SMITH CLERK 1990-12-18 800.00 NULL
8499 ANYA SALESMAN 1991-02-20 1600.00 300.00
8521 SETH SALESMAN 1991-02-22 1250.00 500.00
8566 MAHADEVAN MANAGER 1991-04-02 2985.00 NULL
8654 MOMIN SALESMAN 1991-09-28 1250.00 400.00
8698 BINA MANAGER 1991-05-01 2850.00 NULL
8882 SHIVANSH MANAGER 1991-06-09 2450.00 NULL
8888 SCOTT ANALYST 1992-12-09 3000.00 NULL
8839 AMIR PRESIDENT 1991-11-18 5000.00 NULL
8844 KULDEEP SALESMAN 1991-09-08 1500.00 0.00

e. Write a query to display all the records with all the columns.
f. Write a query to display ename and salary of employees whose salary are
greater than or equal to2200.
g. Write a query to display employee name and salary of those employees who
don‟t have their salary range of 2500 to 4000.
h. Write a query to display employee name and salary of those employees
whose name contains “I” as third alphabet in ascending order of employee
names.
i. Write a query to display the ename and salary with 50% of salary as DA.
j. Write a query to display the employee details whose name contains “M” as
first and “H” as third alphabet.
k. Display the distinct job titles offered by the Organization.
l. Display the employee details who are working as Manager or Analyst.
m. Display the names of employees who joined the organization on or after
10/05/1991.
n. Write the command to display the system date.
o.Write the command to display the name of current month.
19. SQL program - the use of DML commands
Open MySQL and create database Std and a table named student. Write and execute the
commands for the following queries.
No Name Stipend Stream Avgmark Grade Class Date of join
1 Karan 400.00 Medical 78.5 B XI B 2009-05-06
2 Divakar 450.00 Commerce 89.2 A XI C 2009-07-05
3 Divya 300.00 Commerce 68.6 C XII C 2011-11-05
4 Arun 350.00 Humanities 73.1 B XII C 2012-12-08
5 Sabina 500.00 Non -Medical 90.6 A XI A 2012-01-08
6 John 400.00 Medical 75.4 B XII B 2008-09-29
7 Robert 250.00 Humanities 64.4 C XI A 2009-10-08
8 Rubina 450.00 Non-Medical 88.5 A XII A 2011-04-08
9 Vikas 500.00 Non-Medical 92.5 A XII A 2011-04-08
10 Mohan 300.00 Commerce 67.5 C XII C 2007-03-10
a. Write the command to display the system date.
b. Write the command to display the name of current month.
c. Write the command to print the day of the week of your birthday in the year 2015.
d. Write a query to display student names in lower case from student table.
e. Write a query to display last 3 characters from all the names of students from student
table.
f. Write a query to display student name along with the position of „N‟ character in
student column from student table.
g. Write a query to display name and two characters from 2nd position in Stream column
from student table.
h. Write a query to display name and weekday on which they joined from student table.
i. Write a query to find out the result of 6³.
j. Write a query to find out the result of 30 ½ (square root of 30).
k. Write the command to display the name and its length from student table.
l. Write the command to round off value 15.193 to nearest ten‟s i.e. 20.
m. Write a query to display name concatenated by stream from student table.
Write a query to display students name, class and number of years since they joined
20. SQL program – the use of DDL Commands
Write and execute the MySQL commands for the following queries

a. Create table CUSTOMER as per following Table structure.

COLUMN NAME CUSTID CUSTNAME CUSTADD CUSTCITY CUSTPHONE

DATA TYPE INTEGER VARCHAR VARCHAR VARCHAR VARCHAR


LENGTH 7 30 40 30 10
CONSTRAINTS PRIMARY NOT
NULL
b. Insert 5 records with relevant information in the Customer table.
c. Update all the records as add „Mr.‟ with CustName.
d. Add one column Email of data type VARCHAR and size 30 to tableCustomer.
e. Add one more column CustIncomeGroup of data type VARCHAR(10).
f.Drop the column CustomerIncomeGroup from table Customer.
g.Modify the column CustCity as change the size 40 characters long.
h.Delete all the records who belongs to „Kerala‟
i.Create table ORDER1 as per following Table structure. Also make CUSTID as
Foreign Key which refers CUSTID of CUSTOMER table.
COLUMN ORDERNO ITEMNAME CUSTID QTY PRICE
NAME
DATA TYPE INTEGER VARCHAR INTEGER INTEGER DECIMAL
LENGTH 5 30 7 5 5,2
CONSTRAINTS PRIMARY NOT
NULL
j. Create a view table TEMPCUSTOMER from existing CUSTOMER table with
CustID, CustName and CustPhone columns.
k. Write command to show the Tables in the customerdetails Database.
l. Drop the tempcustomer table.
m. Drop the customer table.
n.Drop the database customerdetails
EMIRATES FUTURE INTERNATIONAL
ACADEMY

INFORMATICS PRACTICES PRACTICAL QUESTIONS 2021-22

1. Write a Python program to create and display a series of even numbers 2, 4, 6, 8, 10, 12,
14, 16, 18, 20 with index value a, b, c, d, e, f, g, h, I, j using Pandas module. Also do the
following:
a. Display the first 5 index values.
b. Display the last 5 index values.
c. Display the values of index 4,6,and 8.
d. Display the first four index values.
e. Display the index 3 to 7.
f. Display the index 6 to end.
g. Change the element in index 3 to 50
h. Delete the 4th element from the series.

2.Write a Python program to create a series of list [ 34, 29, 65, 57, 42] and do the following:
give the index as [v,w,x,y,yz]
a. Raise to power 2 of values
b. Add 1000
c.. Subtract 500
d. Multiply by 2
e. Divide by 20
f. Display all the values greater than 50
g. Change the index of the series to [I, j, k, l, m]
h. arrange the elements of the series in the descending order

3 i). Write a pandas program to show the attributes of the series based on series of list [ 34,
29, 65, 57, 42].
[index,values,dtype,shape,nbytes, ndim,size, hasnans, empty]

ii). Write a pandas program to create the above dataframe show the attributes of the
DataFrame.
[index,columns,values, axes, dtype,shape,nbytes, ndim,size, hasnans, empty]

4.Create a DataFrame of dictionary consists of Name, Sub1, Sub2, Sub3, Sub4, Sub5 of five
students.
a. Display the DataFrame
b. Change the index to S01, S02, S03, S04, S05
c. Change the index to Name column
d. Change the index to default value
e. Change the column heading from Name to Stuname
f. Add a column Total which is Sub1+Sub2+Sub3+Sub4+Sub5
g. Display only the column Total
h. Delete the column total using del.
i. Delete the column Sub5 using pop().
j. Delete the column Sub4 using drop().

5. Consider the data frame df1 as shown below:


SL.No City MaxTemp MinTemp RainFall

1 Delhi 40 24 24.1
2 Bengaluru 31 25 36.2
3 Chennai 35 27 40.8
4 Mumbai 29 21 35.2
5 Kolkata 39 23 41.8
i).Write down the command that will give the following output

6. . Write a pandas program to show the attributes of the series.


(ii)Write the command to display the rows 1,2,3 from the dataframe df1.
(iii) Change the name of the column „City‟ to „MetroCity‟ and „Rainfall‟ to „RainFall-2020‟
(iv) Add 2 rows with the given data
[6, Pune, 18,28,26.5]
[7,Kochin,23,40,35.8]
(v)Which command is used to change the index column of dataframe df1 as „MetroCity‟
(vi)Change the index to [S01,So2,So3,S04,S05,S06,S07]

6. Given a data frame namely Stationary as shown in the figure.

Color Count Price


Pen Red 3 12
Pen Green 9 11
Pencil Gray 25 8
Pencil Yellow 26 10
Eraser White 99 7

(a) Find all rows with the label ”Pen ”.Extract all columns
(b) List only columns 0 and 2 using iloc
(c) List 2nd ,3rd and 4th rows
(d) List only the columns Count and Price using loc.
(e) Delete columns with label „Color‟ and „Count‟

7. Write a program that reads from a CSV file named product.csv where the separator
character is „$‟. Read only the first 5 rows in your dataframe. Give column headings as
ItemName, Quantity, Price. Make sure to read the first row as data and not as column
headers.

8. Write a program to plot two data sets on the same bar graph. First data set
represents the marks of Boys and second data set represents marks of girls
in a class
Boy_mark=[34,67,87,90,34]
Girl_mark=[45,80,23,56,99]
Proper labels, title and legends should be given to the plot.

9. Write a python program to draw a histogram with following information:


10 15 10 10 10 15 20 20 20 20 20 25 25

The histogram should have following information


a) X-axis label should be score and Y-axis should be Frequency
b) The title should be Frequency of Score
c) The colour of histogram should be blue with 10 bins

10. WAPP to generate the given graph.

11 a. Consider the given dataframe object salesdf ,


Qtr1 Qtr2 Qtr3
Abu Dhabi 4500 8000 5000
Dubai 6000 4500 6500
RAK 7000 6000 7500

Write python program to display citywise sale in the given format :

The sales of Abu Dhabi is :


Qtr1 4500
Qtr2 8000
Qtr3 5000
Name: Abu Dhabi, dtype: int64

The sales of Dubai is :


Qtr1 6000
Qtr2 4500
Qtr3 6500
Name: Dubai, dtype: int64

The sales of RAK is :


Qtr1 7000
Qtr2 6000
Qtr3 7500
Name: RAK, dtype: int64

11b. Consider the given dataframe object salesdf ,


Qtr1 Qtr2 Qtr3 Qtr4
Abu Dhabi 4500 8000 5000 9000
Dubai 4000 4500 6500 6000
RAK 7000 6000 7500 5000
SHARJAH 6000 5000 7500 6500

12. Write python program to display sale in the given format :

Column Qtr1
containing :
Abu Dhabi 4500
Dubai 4000
RAK 7000
SHARJAH 6000
Name: Qtr1, dtype: int64
Column Qtr2
containing :
Abu Dhabi 8000
Dubai 4500
RAK 6000
SHARJAH 5000
Name: Qtr2, dtype: int64
Column Qtr3
containing :
Abu Dhabi 5000
Dubai 6500
RAK 7500
SHARJAH 7500
Name: Qtr3, dtype: int64
Column Qtr4
containing :
Abu Dhabi 9000
Dubai 6000
RAK 5000
SHARJAH 6500
Name: Qtr4, dtype: int64
13. Consider the given dataframe object salesdf ,

Write python program to display Employee wise sale in the given format :
The sales of EMP1 is :
containing :
Sales1 2000
Sales2 1000
Sales3 4000
Name: EMP1, dtype: int64
The sales of EMP2 is :
containing :
Sales1 4500
Sales2 5600
Sales3 1200
Name: EMP2, dtype: int64
The sales of EMP3 is :
containing :
Sales1 4300
Sales2 6700
Sales3 2500
Name: EMP3, dtype: int64

14 .WAPP to create a series „sair‟ of flightno. And flightname stored in a dictionary or key
value pair.
1101 Air Arabia
1102 Lufthansa
1103 Air India
1104 Lufthansa
1105 Etihad Airways
A) Add 106 Emirates airlines to services
B) Make a copy of „sair‟
C) Delete Air India
D) Update Lufthansa to Air Lufthansa
E) Display original and copied series

 Prepare SQL queries based on XI and XII.

You might also like