0% found this document useful (0 votes)
146 views48 pages

IP Practical File - Edited

Here are the SQL queries for the given problems: i) SELECT POWER(3,4); ii) SELECT CURRENT_DATE, CURRENT_TIME; iii) SELECT ROUND(-34.4567,2); iv) SELECT MOD(10.5,3); v) SELECT LENGTH('fifa World Cup');

Uploaded by

ujjwalgarg10a
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)
146 views48 pages

IP Practical File - Edited

Here are the SQL queries for the given problems: i) SELECT POWER(3,4); ii) SELECT CURRENT_DATE, CURRENT_TIME; iii) SELECT ROUND(-34.4567,2); iv) SELECT MOD(10.5,3); v) SELECT LENGTH('fifa World Cup');

Uploaded by

ujjwalgarg10a
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/ 48

Bharti Public School

Informatics practices
(CODE– 065)

PRACTICAL FILE

Submitted by Submitted to
S.Keerthi Varshna
Ujjwal Garg PriyankaRastogi
Priyanka Rastogi
Pandas
Programs
Pandas
programs
1. Create a pandas series from a dictionary of
values and an ndarray.
ujjwalgarg
2.Write a program to create a series object
using a dictionary that stores the number
of students in each section of class 12 in
your class.
ujjwalgarg
3. Write Python program to Create a Data
Frame with the help of dictionary, which
contains the information about Marks of five
students of five subjects. Write commands to
create dictionary also. Dictionary Contains:
Name Maths Science SSt Hindi Total
Aditya 55 76 69 79 279
Saloni 77 88 55 66 286
Muskan 98 87 90 93 368
Tamanna 90 99 96 91 376
ujjwalgarg
4. Write python code to create a data frame
from a 2D dictionary, Sales which stores the
quarter-wise sales as inner dictionary for two
years, as shown below :
Sales = {‘yr1’ : {‘q1’ : 34000, ‘q2’ : 56000, ‘q3’:
85000},‘yr2’ : {‘q1’ : 44000, ‘q2’ : 66000, ‘q3’:
55000}}
ujjwalgarg
5. Write a program to create a series object
from an ndarray that stores characters from ‘a’
to ‘g’.
ujjwalgarg
6. Create a data frame for examination result
and display row labels, column labels data
types of each column and the dimensions.
ujjwalgarg
g
7. Filter out rows based on different criteria
such as duplicate rows.
ujjwalgarg
8. Write a program to Import and export data
between dataframe and CSV file.
ujjwalgarg
9. Create a series object Vowel to store all
vowels individually. Its index should be
1,2,3,4,5.Convert it into dataframe and display.
ujjwalgarg
10. Create a series object population to store
the population of five different metro cities
and display the population that are more than
30 Lacs.
ujjwalgarg
11.Consider the following Series S
0 0.430271
1 0.617328
2 0.265421
3 0.836113
What will be returned by the following
statements?
a)S*100
b)S>0
c)S1=pd.Series(S)
d)S3=pd.Series(S1)+3
12. Consider the given DataFrame ‘Genre’:
Type Code
0 Fiction F
1 Non Fiction NF
2 Drama D
3 Poetry P
Write suitable Python statements for the
following:
i. Add a column called Num_Copies with the
following data:[300,290,450,760].
ANS:Genre["Num_Copies"]=[300,290,450,760]
ii. Add a new genre of type ‘Folk Tale' having
code as “FT” and 600 number of copies.
ANS:Genre.loc[4]=["Folk Tale","FT",600]
iii. Rename the column ‘Code’ to ‘Book_Code’.
ANS:Genre=Genre.rename({"Code":"Book_Co
de"}, axis=1)
13. Create the series object S with values as
‘COMFORTABLE’ and index ranging from S1
to S11 and perform the following operations:
a. Display first four elements.
b. Display last 3 elements
c. Change the index as W1 to W11.
14. Create a dataframe ‘Student’ from two
series - Name and Grade, Name and marks of
five students.
a. Display the first three records from the
student dataframe.
b. Display the last two records from the
student dataframe.
ujjwalgarg
Matplotlib
Matplotlib
programs
Programs
15. Write a program to display a horizontal bar
chart of the number of students in a class.
Class: 1= I, II, III, IV, V, VI, VII, VIII, IX, X, XI
and XII.
Strengths: 40, 43, 33, 41,50, 49, 47, 50, 42, 44,
46,39
16. Write a program to analyze the
performance of the students subject wise on
the school result data using matplotlib library.
Name Maths Science SSt Hindi Total
Aditya 55 76 69 79 279
Saloni 77 88 55 66 286
Muskan 98 87 90 93 368
Tamanna 90 99 96 91 376
17. Write a program to visualize a weather
report for three consecutive weeks through
Line Plot using ‘Weather.csv’ .
Week1 Week2 Week3
36 37 36
38 39 40
42 41 40
40 41 42
39 40 41
35 34 33
40 38 39
18. Given below are the sugar levels for men
and women in a city. Compare the sugar
levels amongst them through a histogram.
Men: [112,85,149,82,129]
Women: [67,77,76,150,100]
SQL
SQL QUERIES
Queries
19. Preeti manages database in a blockchain
start up. For business purposes , she created a
table named BLOCKCHAIN. Assist her by
writing the following queries.
Table: BLOCKCHAIN

Id User Value Hash Transaction_Date


1 Steve 900 ERTYU 2020-09-19
2 Meesha 145 @345r 2021-03-23
3 Nimisha 567 #wert5 2020-05-06
4 Pihu 678 %rtyu 2022-07-13
5 Kopal 768 Rrt4% 2021-05-15
6 Palakshi 534 wer@3 2022-11-29
i. Write a query to create the structure of the
above table.
ii. Write a query to display the year of the
oldest transaction.

iii. Write a query to display the month of the


most recent transaction.

iv. Write a query to display all the


transactions done in the month of May.

v. Write a query to count total number of


transactions in the year 2022.
20. Write SQL commands for the following
queries (i) to (v) based on the relations Teacher
and posting given below:
Table: TEACHER

T_ID Name Age Department Date_Of_join Salary Gender


1 Jugal 34 CS 10/01/17 12000 M
2 Sharmila 31 History 24/03/08 20000 F
3 Sandeep 32 Maths 12/12/16 30000 M
4 Sangeeta 35 History 01/07/15 40000 F
5 Rakesh 42 maths 5/09/07 25000 M
6 Shyam 50 History 27/06/08 30000 M
7 Shiv Om 44 CS 25/02/17 21000 M
8 Shalakha 33 Maths 31/07/18 20000 F
(i) To show all information about the
teacher of History department.

(ii) To list the names of female teachers who


are in mathematics department.

(iii) To list the names of all teachers with


their date of joining in ascending order.

(iv) To display teachers name , salary, age for


male teachers only.

(v) To display name, bonus for each teacher


where bonus is 10% salaRy.
21. Write suitable SQL queries for the
following:
i. To calculate the exponent for 3 raised to
the power of 4.

ii. To display current date and time.

iii. To round off the value -34.4567 to 2


decimal places.

iv. To display the remainder after dividing


10.5 by 3.

v. To display The lengTh of The sTring ‘fifa


World Cup’.

You might also like