IP Practical File - Edited
IP Practical File - Edited
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