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

, f-M ,..t~ .._,,~ :- ,,,,,, 1'_..fll':,,.

R · .' @ CEN TRA L BOA RD OF SEC OND ARY EDUCATION

CKC AC AD EM Y
l ~ . .
l--
~
'

:~
~, ·~
JH AN SI

1--...
'~

.;} ;
~
cc '
INFORMATION PRACTICES .,
i•
·; : PRACTICAL FILE

NT OF INFORMATICS PRAC TICES


,_

PRAC TICAL RECORD FILE IS SUBMITTED TO DEPARTME

FOR THE PARTIAL FULLFILLMENT OF

AISSCE EXAMINATION
SESSION _ 2022-2023
'tt
~_;~
~
~~-
~,&

SUBMITTED BY : SUBMITTED TO : ~'


-· 'l{

~IYA AH!RWAf{ HOD(COMPUTER) :


XII A Mr. ATUL KUM AR SAHU
t~
ROL LNO . ~I
,...
~:•.:-:•i

,i'"
~-
¥1"!
~ Riya Ahirwar

~
~
~ Acknowledgement
~ I wish to express my deep sense of gratitude and
indebtedness to our learned teacher Mr. Atul Kumar
Sahu, PGT COMPUTER SCIENCE, CKC Academy
for his invaluable help, advice and guidance in the
preparation of this project.
I am also greatly indebted to our principal Fr. Sagaya
Nathan and school authorities for providing me with the
facilities and requisite laboratory conditions for making
this practical file.
I also extend my thanks to a number of teachers, my
classmates and friends who helped me to complete this
practical file successfully.

., . Riya Ahiiwar (tt1 A)

-..
..

c...
#

c....
~
~
rr '
,.••
~
.,....---
Riya Ahirwar

::...• Certificate
....
.....
This is to certify that Riya Ahirwar student of Class XII,

.,.... CKC Academy has completed the Term I - PRACTl CAL 1

::
..,__.
FILE during the academic year 2022 - 2023 to wards 1

partial fulfillment of credit for the Informatics Practices


practical evaluation of CBSE and submitted satisfactory
e ~
report, as compiled in the following pages, under m:y
supervision.

Total number of practical certified are:


External Examiner Internal Examiner

Signature: Signature:

'--~ '
• //.~-1
Head of the Department Pnfr ·Seal
Signature: and~tDature:
Riya Ahirwar

.,.
• 11 Data Handling -
Contents

...
....
S No.
1
Practicals
Create a panda's series
Oat£, Signature
~~ -
.,,..
from a dictionary of os-o:r- -2022
,.,,..-;-a112,- y'

values and a ndarray . ~I


2 Given a Series, print
•• all the elements that are
above the 75th percentile.
12-ol--2.02.2
~~-,,,
r',):..Jo
3 Create a Data Frame
quarterly sales where
~~ -
each row by the category, 19 -of-202.2.
item name, and
expenditure. Group the 10J '(){17,, y
rows by the category and
print the total expenditure
per category.

-.• •• 4 Create a data frame for


examination results and
display row labels, 2. b-Of-2..022.
~hr .
---
tt' • column labels data types 1
G/6 -f{ -i 1./'

• ◄
of each column and the

ti•
.,
dimensions .

• 5 Filter out rows based on


different criteria such as o2..-0 f - z..e 1.z. _,,,/~,),~
{Pfbtvi .
Dl/}o
duplicate rows.

3
I
Riya Ahirwar

S No. Practicals Date Signature


1 Create a student table
with the student id, name, ' .
~Vh .
and 1narks as attributes I 1, - 09 - 2. 0 2. 2
---- ,, -y
where the student id is
\. 11'1~
the primary key.
2 Insert the details of a new 2 0 -0-'- 202.2.
student in the above
I
I
t~~ .
~27,,
table. Y'J{d11
3 Delete the details of a I I -l O - 2D.2.2
\I
student in the above ~ -r
table. I' (
tO ['
4 Use the select command
to get the details of the oI - II - 20 2. 2.
students with marks in a ~)
student marks more than oJ /\\l?v
C,.
• 80

.,cc._.
5 Find the min, max, sum, IS - JI-: 2.022.
te.. and average of the marks : i' ~ -
in a student marks table. lstt~

--. 6 Find the total number of


customers from each
country in the table
(customer ID, customer
' I
'

2. 2. - I I -2.022.
'
(ifz9l .
/v
~,,1-z- .
Name, country) using
group by.
7 Write a SQL query to
order the ( student ID, t(o'rit-
, ,I I ~?/'
marks) table in
descending order of the
2 9 - I I ""'2. 0 22. ~ l ''\"'
marks.

5
Riya Ahirwar

Data Handling
[ 1] Create a panda's series from a dictionary of values
and a ndarray.
import pandas as pd
import numpy as np
def pro30:
#Creating series from a dictionar y
d --{'J. an '·31 ,_ . , 'M ar '·31
. , 'Fpb'·28 . ,
'Apr':30}
S=pd.Series(d)
printC Series from dictio nary")

print(s)

#Creating series from an ndarray


n = np.array([2,3,4,5,6])
print("n\Serie s from ndarray")

;-.; . . '/:
~~-

f
It . !
l', Riyn Ahirwar

•• pri nt( '' ,.,~,-· ... '" '"" "" '" ,.,, .,.

s1 =pd.Series(ar)
, ., .. , . -. , - • . , r'r • ")


.)It print(s1)

~
-- pro30
i~
File
IDLE Shell 3.11 .0

Edit Shell Debug Options Window Help


___
D

l/Pr ogr ams /Py tho n/P yt bon 3 ll/


fl
X

...-..
App Dat a/L oca
>>> =RE STA RT: C:/U sers /AS US/
oatn umb ers . py
Ser ies from dic tion ary

Jan 31
Feb 28
Mar 31

....
._
~ Apr
dty pe:
30
int6 4

Ser ies from nda rray

._ 1
0 2
3
4
2
~ 3 5
4 6
~ dty pe: int3 2
~ >» /I
- · -- -- - --- - - ---- --- ---- -- -
- - - -- - - - - -
Ln: 21 Cot~j
~
~ ~
'
,,.
~
I
r
ven a Se ries, print all the elements that are above
[2] Gi
the 75th percentile .
,• ••
• •e
"'. I
Iii
'1iiiii
I •
~
• 7
Riya Ahirwar



I


-
••
import pandas as pd .

def Ser_stumarks():

-- std_marks = []
-- for i in range( 1, 6):
at
-
~
'!!!la
m = int(input("Enter the Percentile:"))
'!!le
std_marks.append(m) 4
....
~

~ s = pd.Series(index=range(1201,1206),
,....
~
data std_marks)
,...
,... print("Data fetched from the Series
,-4 are:")
,,,,.
~ print(s[s>=7 5])

,...re.
......
__I

~
~

i.
4--
f
8
Riya Ahirwa r f.\ ...

D X !
· ,A IDLE Shell 3. 11 .0
I File Edit Shell Debug Options Window Help

on/Py th o
>>>=R ESTAR T: c:/Use rs/ASU S/App Data/L ocal/P rogram s/Pyth
n311/p ercent ile.py =
Ente r the Per:ce ntile:6 3
l~nter: the Per:ce ntile:7 8
!Enter: the Per:ce ntile:5 2
: Enter the Per:ce ntile:8 8
!Enter the Percen tile:83
!Data fetche d from the series are:
: 1202 78
j 1204 88
1205 83
ldtype : int64
:~:I Ln: 6 Col:O

[3] Create a data frame quarterly sales where each row


contains the item category, item name, and expenditure.
Group the rows by the category and prin t the tota l
expenditure per category.
••,.
••
impo rt pandas as pd
,
-.
· .

.,. data = {'Category':['Medical', 'Grocerry', 'Clothes'], 'Item


.

r: ..-. :
• t• Name ':['Sanitizer', 'Sugar', 'Tshirt'], 'Expenditure':
[1000,500,5200]}

quarterly_sales-pd.DataFrame(data)
print(quarterly_sales)

2•
I
c=quarterly_sales.groupby('Category')
,p
f • print('Result after filteri ng')
• • print(c['Category', 'Expenditure'].sum())
• •
9
-
.. .. ..
\I
-~ - ~♦ ww

•-•
Riya Ahirw ar

-- i,.. IDLE Shell 3.11 .0 D X


File Edit Shell Debug Options ~indow _ Help _
>>> -- -- · -
=

.-..
RESTART: C:/Use rs/ASU S/App Data/L oca l/P rog rams/ Pytho n/Pyth
on311 /,k.py ==--=
catego ry Item Name Expen diture
0 Medic al Sanit izer

-- I
1000
1 Groce rry sugar 500
2 Cloth es Tshir t 5200
!Resu lt after filter ing

Expen diture

-_ J
~

..,.. >
Categ ory
Cloth es
Groce rry
Medic al
- -- ---
5200
500
1000
---- - - - ----- -- --- -· -·- - - - - - - -
I
....
Ln: 19 Col: 226

.,_
~

t:M
t!lle

....
~

... [4] Create a data frame for examination results and


display row labels, column labels data types of eac h
....
....
column and the dimensions .
import pandas as pd

,...
~

,,_
def df_std_resO:
res={'Amit':[76,78,75,66,68],

,...
~

,...
'Shi aIesh ':[78,56, 77,49,5 5],
'Rani':[90,91,93,97,99],

....
-l
'Madan':[55,48,59,60,66],
'Radhika':[78,79,85,88,86]}
df= pd.DataFrame(res)

10
Riya Ahirwar

print("P rinitng row labels in a list:")


• t('' ~ ~ ~~~ ~~· ~ -~ ~~ ~~~ ~·~~ -.,,
pr1n ,-..,J ,._. ""'-J ,..._, -., ,..._, ,-..., r-.J ,._, ~ ,-..,r II)

idx=df.index
I= Ii st(idx)
print(!)
print("Prinitng row labels in a list:")
print("~~ ~~ ~~~~~~~~~~~~~~~~~~~~~~~~~··)

print("[",end=" ")
for col in df.columns:
print(col,end=" ")
print("]")
••
print("Printing Data Types of
each column")

print(df.dtypes)

.... print("Printing dimensions of



p
• Data Frame")

• 8 . ("
prrnt ~~~~~~~~~~~~~~~~~~~~ ~ ~ ~~ ~~~ ~~")

., ••
9
print(df.ndim)

.. ,.• df_std_resO
~ ' } ,::
.......
-·~·-

Dlai I

11
Riyn Ahirwar

'Amj ad ', 'Roh an',


'Amit', 'Sumit',
'Matth ew', 'Kartik ',
'Kavita', 'Pooja'],
'perc' : [79.5, 29, 90.5,
np.nan, 32, 65, 56,
np.nan, 29, 89],
'qualif y': ['yes', 'no',

'yes', 'no', 'no',

'yes', 'yes',

'no', 'no',
'yes']}

exam_data1 = pd.DataFrame(exam_dic1)

.. ,. print(" Origin al DataFrames:")

." ;• print(exam_data 1)
print(" \nUse = = opera tor\n")

".
_, P•
print(exam_data1 .loc[exam_data1 ['name '] ==
'Rohan '])
• r•
• ••
•• •e p ri nt("\n Use < ope rato r\n ")

• -• print(exam_data1 .loc[exam_data1 ['perc '] <

. ,.
• ••
,.I. 13

- 4~

. . .~ .:J..f). ;,: :~ ·\::~ ~~_;'.;\:.~~~~ ~-},>r:?~~~~~q :~~:- ~~.:~·: .:~~~:~: .~~~'S~;~~:-T5r ,·/~-~~
t Riya Ah irwar

••
-
.•
401)

p rint( "\ n Use != o pe rato r\ n'')


It print(exam_data1 .loc[exam_data1 ['qu alify ']

.•
"9
!= 'no'])

-•- • prin t("\ n Mu ltipl e Con d itions\ n")


print(exam_data1 .loc[(exam_data1 ['qu alify '

] != 'yes') & (exam_data1 ('perc']


-- <40)])

--
~
# Filter out rows based on diffe rent crite ria
rows
such as dup lica te

!ae imp ort pandas as pd



~
data={'Name':['Aman','Rohit','Deepika',

~ 'Aman',' Dee pi ka ', 'Sohit','Geeta 1],

r-.
,.. 'Sales':[8500,4500,9200,8500,9200,9600,84

..,... O]}

....... sales=pd.DataFrame(data)
# Find duplicate rows

....
...,_
Duplicated = sales[sales.duplicated(keep= Fals
prin t("d upli cate Row :\n" ,dup lica ted)
e)]

....,J I
e

14
... '
' '' .l I I . I I
J - -
' I J
·- -
I
I . I 'I
I

11-t _:--
I .
·-
!

I
Ii - •

..-( I
.. I
_.· \ -·

VJ I I
p .:I=--,
d -
', j"" =-~ I' ,,
1

1 I
. - , :1 /' ' It;
1
l vi
;,l 'I
...J •
-
.x
. II f

I \
~~---=--=-

I •
\ ,.
I \'·
·~ [1 iI,
'II,

' 1:

. Ii

You might also like