Professional Documents
Culture Documents
XII IP Lab Manual - 2022 - 23
XII IP Lab Manual - 2022 - 23
XII IP Lab Manual - 2022 - 23
1) Write a python to create a panda’s series from a dictionary of values and a ndarray
ANS:
OUPUT
1
Informatics and Practices (065) Lab Manual – 2022-23
2. Create a data frame for examination result and display row labels, column labels data types of each column
and
the dimensions
ANS:
OUTPUT
OUTPUT
2
Informatics and Practices (065) Lab Manual – 2022-23
4. Write a python program to find marks of all the students greater than 57 and also display whose marks are in
between 70 and 80.
ANS:
OUTPUT
3
Informatics and Practices (065) Lab Manual – 2022-23
5. Write a menu driven python program to perform the following operation on a Series object
Slicing of Series object without step
Slicing of Series object with step
Exit
Ans:
4
Informatics and Practices (065) Lab Manual – 2022-23
OUTPUT
5
Informatics and Practices (065) Lab Manual – 2022-23
6
Informatics and Practices (065) Lab Manual – 2022-23
6. Write a python program to create a line chart from the following sales.csv file. Consider month_number of
X-axis and ‘total_profit’ on Y-axis
Ans:
OUTPUT
7
Informatics and Practices (065) Lab Manual – 2022-23
7. Write a python program to create a bar chart from the following sales.csv file. In bar graph, represent
facecream and facewash sales in every month.
Note: Consider the same sales.csv file which is given in QNo. 6
Ans:
OUTPUT
8
Informatics and Practices (065) Lab Manual – 2022-23
8. Write a python program to create a line chart from the following sales.csv file. Each product sales should
come on Y-axis and month name should come on X-axis with different markers.
Note: Consider the same sales.csv file which is given in QNo. 6
Ans:
OUTPUT
9
Informatics and Practices (065) Lab Manual – 2022-23
9. Write a python program to create a histogram from the following sales.csv file. Consider range of
‘total_income’ X-axis and that range count on Y-axis
Ans:
OUTPUT
10
Informatics and Practices (065) Lab Manual – 2022-23
10. Write a Pandas program to create a Series object and then display the Series object elements
which are exactly divisible by 5.
Ans:
OUTPUT
11
Informatics and Practices (065) Lab Manual – 2022-23
11. Write a Pandas program to add, subtract, multiple and divide two Pandas Series.
ANS:
OUTPUT
12
Informatics and Practices (065) Lab Manual – 2022-23
12. Write a Python Program to create the DataFrame with following values and perform attributes
of DataFrame on it.
Name Rno Marks Addr
Ram 1 56.78 Bangalore
Keshav 2 62.12 Mangalore
Riya 3 77.89 Chikmagalur
Madhav 4 88.09 Mysore
Zara 5 99.00 Hubli
Chandhan 6 98.00 Coorg
ANS:
OUTPUT
13
Informatics and Practices (065) Lab Manual – 2022-23
13. Write a Python Program to create the following DataFrame and perform Boolean
Indexing on it.
ANS:
OUTPUT
14
Informatics and Practices (065) Lab Manual – 2022-23
14. Write a Python Program to create the following DataFrame and selecting rows/column using loc
and iloc function.
ANS:
OUTPUT:
15
Informatics and Practices (065) Lab Manual – 2022-23
15. Write a Python Program to create the following DataFrame and replace all negative numbers with
zero(0).
Ans:
OUTPUT
16
Informatics and Practices (065) Lab Manual – 2022-23
16. Write a Python Program to create a DataFrame using dictionary of Series, dictionary and CSV
files.
OUTPUT:
17
Informatics and Practices (065) Lab Manual – 2022-23
18
Informatics and Practices (065) Lab Manual – 2022-23
17. A python program to create a DataFrame from CSV file and perform iterrows() and iteritems() methods
on DataFrame.
Ans:
19
Informatics and Practices (065) Lab Manual – 2022-23
OUTPUT
20
Informatics and Practices (065) Lab Manual – 2022-23
18. A python program to create a DataFrame from CSV file and perform head() and tail() operations on
DataFrame.
Ans:
OUTPUT
21
Informatics and Practices (065) Lab Manual – 2022-23
19. Write a Python Program to create a Series object using arrange() method and perform
attributes of Series on it.
Ans:
OUTPUT
22
Informatics and Practices (065) Lab Manual – 2022-23
23
Informatics and Practices (065) Lab Manual – 2022-23
SQL
20) Consider the following table and write SQL commands for all the questions
iv. List all the tables that exists in the current database
Ans
24
Informatics and Practices (065) Lab Manual – 2022-23
25
Informatics and Practices (065) Lab Manual – 2022-23
xi. Display the garment names whose price is in between 900 to 1200
Ans
(or)
26
Informatics and Practices (065) Lab Manual – 2022-23
xii. Display the garment names whose available quantity is more than 20
Ans
xiv. Display the garment type based on ascending order of their names
Ans
(or)
27
Informatics and Practices (065) Lab Manual – 2022-23
xvi. Display the garment type based on descending order of their price.
Ans
xvii. Display the garment code whose name doesn’t starts with pant
Ans
xviii. Display all the garment codes and their names except whose prices is in between 800 and
1200
Ans
28
Informatics and Practices (065) Lab Manual – 2022-23
(or)
xx. Add a new column called ‘brand’ which will accept the values as strings.
Ans
xxii. Change the garment type to “bell bottom” whose garment code is “10045”
Ans
29
Informatics and Practices (065) Lab Manual – 2022-23
21) Consider the following empl table and write SQL commands for the following questions from (i) to
(xxxii).
30
Informatics and Practices (065) Lab Manual – 2022-23
iv) Display all the employees minimum, maximum and average salaries
Ans:
vi) Display average salary of all employees who are working in deptno 20.
Ans:
31
Informatics and Practices (065) Lab Manual – 2022-23
vii) Display the total number of employees who are working for department number 10.
Ans:
ix) Write a SQL command to display total salary for each department along with dept no.
Ans:
x) Write a SQL command to display number of employees in each department along with
dept no.
Ans:
32
Informatics and Practices (065) Lab Manual – 2022-23
xi) Write a SQL command to display average salary of employees in each job type.
Ans:
xii) Write a SQL command to display HIGHEST, LOWEST salary of employees in each job type.
Ans:
xiii) Write a SQL command to display employee name and their job in the increasing order of their salary.
Ans:
33
Informatics and Practices (065) Lab Manual – 2022-23
xiv) Display the name of departments. Each department should be displayed once.
Ans:
34
Informatics and Practices (065) Lab Manual – 2022-23
xvii) Display the position of the string ‘LE’ in field job of table EMPL.
Ans:
xviii) Display the jobs where the number of employee is less than 3.
Ans:
35
Informatics and Practices (065) Lab Manual – 2022-23
36
Informatics and Practices (065) Lab Manual – 2022-23
xxiii) Display employee name by trimming left side and right side spaces
Ans;
37
Informatics and Practices (065) Lab Manual – 2022-23
xxv) Display employee name and month of join (month should be in decimals)
Ans:
38
Informatics and Practices (065) Lab Manual – 2022-23
39
Informatics and Practices (065) Lab Manual – 2022-23
xxix) Display employee name and their job who joined in the year of 1993.
Ans:
xxx) Display employee name and their job who joined in the month of ‘January’.
Ans:
xxxi) Display employee name and their job who joined in the month of ‘01’.
Ans:
xxxii) Display employee name and their job who joined on ‘Tuesday’.
Ans:
40