0% found this document useful (1 vote)
305 views6 pages

1.lab Manual Class Xii 2020-21

The document contains 25 questions related to pandas, dataframes, SQL, and data analysis. It asks the reader to write programs to create, manipulate, and analyze dataframes and series from various inputs. It also contains questions about creating SQL tables and querying data from tables. The questions cover a range of pandas and SQL skills including creating, renaming, selecting, plotting and analyzing data.
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 (1 vote)
305 views6 pages

1.lab Manual Class Xii 2020-21

The document contains 25 questions related to pandas, dataframes, SQL, and data analysis. It asks the reader to write programs to create, manipulate, and analyze dataframes and series from various inputs. It also contains questions about creating SQL tables and querying data from tables. The questions cover a range of pandas and SQL skills including creating, renaming, selecting, plotting and analyzing data.
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/ 6

Dehradun Public School (2020-21)

Informatics Practices (065) Lab Manual


Class XII

Q1. Create a panda series from a dictionary of values and an ndarray.(take values on your own)

Q2. Number of students in classes 11 and 12 in three streams(‘Science’ ,’Commerce’ and ‘Humanities’) are
stored in two series objects C11 and C12.Write code to find total number of students in classes 11 and
12,stream wise.
Q3. Write a program to create panda series given below:
I.
0 a1
1 b1
2 c1
II.
3 d1
4 e1
5 f1
Q4. Series object C stores the charity contribution made by each section(see below):
A 6700
B 5600
C 5000
D 5200
Write a program to display which section made a contribution more than ₹ 5500.

Q5. Write a program to create data series and then change the indexes of the series object in any random
order.

Q6. Write a program to create a dataframe from a 2D list. Specify own index labels.

Q7. A list stores three dictionaries each storing details(old price,new price,change).Write a program to
create a DataFrame from it.

Q8. Given below DataFrame df:


Name Marks
R.no 1 Arun 42
R.no 2 Divya 45
R.no 3 Khushi 26
R.no 4 Tarun 50

(i) Write a program to print the DataFrame df(given below), one row at a time.
(ii) Write a program to print the DataFrame df(given below), one column at a time.
(iii) Write a program to print the only the values from marks column, for each row.

Q9. Write a program to create a dataframe from a 2D array as shown below:

3 6 9
12 15 18
21 24 28

Q10. Consider the saleDf shown below:

Page 1 of 6
Target Sales
zoneA 56000 58000
zoneB 70000 68000
zoneC 75000 78000
zoneD 60000 61000
Write a program to rename indexes of ‘zoneC’ and ‘zoneD’ as ‘Central’ and ‘Dakshin’ respectively and the
column name as ‘Target’ and ‘Sales’ as ‘Targeted’ and ‘Achieved’ respectively.

Q11. Given a Dataframe df:


Name Weight
0 Arun 42
1 Divya 45
2 Khushi 26
3 Tarun 50

Write a program to display only the weight of first and third rows.

Q12. Write a program to create a Dataframe storing Salesman details (name,zone,sales) of five salesman.

Q13. Write a program to print the transpose of the DataFrame created in question no.12.

Q14. Given a DataFrame Marks:

A
B
Acct 68
Acct 92
Eco 90
Eco 92
Eng 89
Eng 91
IP 97
IP 99
Math 87
Math 99
(i) Consider the DataFrame Marks write a program to display total marks secured by A and B in each
subject.
(ii) Consider the DataFrame Marks write a program to display how much marks difference Student B
has with Student A.
Q15. Consider the DataFrame Marks(given in question no.5) write a program to display top two rows’
values of ‘A’ columns and last 3 values of ‘B’ column.
Q16. Write a program to plot a line chart to depict marks of a random student in 10 PTs.
Q17. Consider the following table.
Sales1 Sales2
zoneA 56000 58000
zoneB 70000 68000
zoneC 75000 78000
zoneD 60000 61000
(i) Write a program to plot a bar chart from Sales done by zoneB. In the same chart ,also plot Sales
done by zoneD.
(ii) Write a program to plot a bar chart from Sales done by zoneC.Make sure that the Sales1 and Sales
2 is represented through different colours.
Q18. Write a program to plot a horizontal bar chart from the height of 5 students of your class.
Q19. In the above question(Q19.) add title as “Horizontal Bar chart” and y-axis title as “Value-Range”.

Q20..Write a SQL (DDL) Command to create the following table Student :

Page 2 of 6
COLUMN NAME DATA TYPE Size CONSTRAINT
ROLLNO NUMBER 6 PRIMARY KEY
SNAME VARCHAR 20 NOT NULL
SADDRESS VARCHAR 30
SPHONE VARCHAR 10
FEES NUMBER 9,2
Q21. Write a SQL (DDL) Command to create the following table Railways:

COLUMN NAME DATA TYPE Size CONSTRAINT


TRAINNO NUMBER 6 PRIMARY KEY
TNAME VARCHAR 20 UNIQUE
SOURCE_STATION VARCHAR 30 NOT NULL
DESTINATION VARCHAR 30
SEATS NUMBER 4

Q22. Write the SQL command to create the Table: Customer


Column Name Data Type Size Constraint
CustNo Number 4 PRIMARY KEY
Cname VARCHAR 10 NOT NULL
Address VARCHAR 30
Phone NUMBER 4
PurDATE DATE
Amount DECIMAL (7,2)
Discount DECIMAL (7,2)

Q23.Consider the table: Shop given below. Write commands in SQL for (i) to (v).
Table : SHOP
Icode Item Company Qty City Price
101 Biscuit Hide & Seek 100 Delhi 10.00
102 Jam Kissan 110 Kolkata 25.00
103 Coffee Nestle 200 Kolkata 55.00
104 Sauce Maggi 56 Mumbai 55.00
105 Cake Britannia 72 Delhi 10.00
106 Maggi Nestle 150 Mumbai 10.00
107 Chocolate Cadbury 170 Delhi 25.00
(i) To display Name of the items, whose name starts with ‘C’ in ascending order of price.
(ii) To display code, Item name and City of the products whose quantity is less than 100.
(iii) To count distinct Company from the table.
(iv) To display the records of shops in Delhi
(v)To increase the price by 10% of all the Items which has company as “Nestle”.

Q24.Consider the following table Graduate and answer the following queries:.
SNO NAME STIPEND SUBJECT AVERAGE DIVI
1 KARAN 400 PHYSICS 68 I
2 DIWAKAR 450 COMP. Sc. 68 I
3 DIVYA 300 CHEMISTRY 62 I
4 REKHA 350 PHYSICS 63 I
5 ARJUN 500 MATHS 70 I
6 SABINA 400 CHEMISTRY 55 II
7 JOHN 250 PHYSICS 64 I
8 ROBERT 450 MATHS 68 I

Page 3 of 6
9 RUBINA 500 COMP. Sc. 62 I
10 VIKAS 400 MATHS 57 II
a) List the names of those students who have obtained DIVI 1 sorted by NAME.
b) Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend received in a year assuming
that the STIPEND is paid every month.
c) To count the number of students who are either PHYSICS or COMP. Sc.Graduates.
d) To increase the Stipend by 5% for those who has average greater than 65.
e) Select NAME, SUBJECT from GRADUATE where DIVI=II;
f) Select NAME, STIPEND, DIVI from GRADUATE where AVERAGE>=65;

Q25. Consider the given table employee_tbl and Write the output of queries given below:
+------+------+------------+------------------------------------------+
| id | name | work_date | daily_typing_pages |
+------+------+------------+----------------------------+
| 1 | John | 2007-01-24 | 250 |
| 2 | Ram | 2007-05-27 | 220 |
| 3 | Jack | 2007-05-06 | 170 |
| 3 | Jack | 2007-04-06 | 100 |
| 4 | Jill | 2007-04-06 | 220 |
| 5 | Zara | 2007-06-06 | 300 |
| 5 | Zara | 2007-02-06 | 350 |
+------+------+------------+--------------------+
a)SELECT COUNT(*) FROM employee_tbl;
b)SELECT name, COUNT(*) FROM employee_tbl GROUP BY name;
c) SELECT * FROM employee_tbl WHERE daily_typing_pages BETWEEN 170 AND 300;
d) SELECT id, name, work_date, MAX(daily_typing_pages) FROM employee_tbl GROUP BY name;
e) SELECT MIN(daily_typing_pages) least, MAX(daily_typing_pages) max FROM employee_tbl;
f) SELECT name, SUM(daily_typing_pages) FROM employee_tbl GROUP BY name;
g) SELECT COUNT(*) FROM employee_tbl WHERE name="Zara";
h) SELECT AVG(daily_typing_pages) FROM employee_tbl;
Q26. Consider the following table BusChart and answer the following queries
RTNO AREA_OVERED CAPACITY NOOF DISTANCE TRANSPORTER CHARGES
PASSENGERS
1 VASANT KUNJ 100 120 10 SHIVAMTRAVELS 100000
2 HAUZ KHAS 80 80 10 ANAND TRAVELS 85000
3 PITAMPURA 60 55 30 ANAND TRAVELS 60000
4 ROHINI 100 90 35 ANAND TRAVELS 100000
5 YAMUNA VIHAR 50 60 20 BHALLA CO. 55000
6 KRISHNA NAGAR 70 80 30 YADAV CO. 80000
7 VASUNDHARA 100 110 20 YADAV CO. 100000
8 PASCHIM VIHAR 40 40 20 SPEED TRAVELS 55000
9 SAKET 120 120 10 SPEED TRAVELS 100000
10 JANK PURI 100 100 20 KISAN TOURS 95000
(a) To show all information of buses where capacity is more than the no of student in order of rtno.
(b) To show area_covered for buses covering more than 20 km., but charges less then 80000.
(c) To show transporters wise total no. Of passengers traveling.
(d) To show rtno, area_covered and average cost per passenger for all routes where average cost per
student is - charges/noofpassengers

Page 4 of 6
(e) Add a new record with following data:
(11, “ moti bagh”,35,32,10,” kisan tours “, 35000)

Q27. Consider the following tables and answer the following queries:
Table: Employee
EMPNO ENAME JOB MGR HIREDATE SAL DEPTNO
--------- ---------- --------- --------- --------- --------- --------- ------------- ----- ---------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-88 1600 30
7521 WARD SALESMAN 7698 22-FEB-85 1250 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 7697 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-8 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10

a)Write query to display employee name, department number of those employees whose salary is
between 1500 and 2500.
b)Display employees details jobwise.
c)List employee name and their Hiredate of those who were hired after year 1985.
d)Count the total numbers of employees in each department.
Q28 Consider the following tables Employee and salary. Write SQL commands for the statements (a) to
(c) and give outputs for SQL queries (d) to (f)
TABLE : EMPLOYEE
EID NAME DEPTID QUALIFICATION SEX
1 DEEPALI GUPTA 101 MCA F

2 RAJAT TYAGI 101 BCA M

3 HARI MOHAN 102 B.A M

4 HARRY 102 M.A M


5 SUMIT MITTAL 103 B.TECH M

6 JYOTI 101 M.TECH F


a)To display the frequency of employees department wise.
b)To list the names of those employees only whose name starts with ‘h’
c)To add a new column in employee table . The column name is salary.
d)Select sum(DeptId) from employee where Qualification like ‘B.%’;
e) Select count(*) from employee group by sex;
f) Select distinct deptid from employee;

Q29. Consider the table ‘College’ given below. Write commands in SQL for (i) to (v) and output
for (vi) and (vii).
Table: College

Page 5 of 6
Sno Name Address Join_Dt Fee Semester
1001 Rahul 12,Vasant Kunj 2010-02-02 8000 I
1002 Amit 187, R.K.Puram 2011-09-08 7000 II
1003 Rakhi B6,Lajpat Nagar 2012-09-08 7500 I
1004 Suhas 345,Patel Nagar 2009-01-12 9000 III
1005 Deepika 10,Geeta colony 2008-02-02 10000 IV
1006 Harish L-12,Preet vihar 2009-11-02 9000 III
1007 Aparna H12, Hari Nagar 2010-01-05 8500 I

(i) To display all information from the table College.


(ii) To display Sno and Name of those student who joined after 31st Jan 2010.
(iii) To display Name, Fee and Semester of those student who are in III Semester.
(iv) To display the name of students whose name has last alphabet as ‘A’.
(v) To insert a new row in the table COLLEGE:
1008,”Mohan”,5-C,Uttam Nagar”,”2010-02-15”,7300,”II”
(vi) Select DISTINCT(Semester) from College;
(vii) Select MAX(Fee) from College where Address like ‘% Nagar%’;

Q.30 Write the following commands:


(i) To display name of weekday for date 4th March 2018.
(ii) To display current time.
(iii) To print day of week of your Birthday in the year 2010.
(iv) To display the name of current month
(v) To display date after 15 days of current system date.

Page 6 of 6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy