Practical File Infomatics Practices 2024-25
Practical File Infomatics Practices 2024-25
Session 2024-25
Name: Advaita Mishra
Stream: Commerce
Class: 12th-C
Roll Number:06
Certificate
attribute function
L y,
XVI
XVII
XVIII
XIX
XX
XX
XXII
XXill
XXIV
XXV
XXVI
XXVII.
XXVIII.
XXIX.
XXX.
Inserting values
Foreign key
MinO, Max(),Sum(Q, Average() functions
name
SQL Query
Display today's date in "Date/Month/Year"
Format
XXXI.
XXXII.
XXXiIll.
XXXIV.
XXXV.
XXXVI.
XXXVII.
XXX VIII.
XXXIX.
XXXX.
than 400000.
# create a dictionary
dictionary « ('t' : #, 3B, Cs
# creote @ series
series » pd.Serles(¢ictlonary
print( series)
4 Wt
' ®
¢c
dtype: Intéd
#2. Create a Data Frame quarterly sales where each row contains the
item category, item name, and expenditure. Group the rows by the
category, item name and expenditure.
import pandas as pd
quartsales«pd.Datafrane(dic)
print(quartsales)
qsequartsales.groupby(‘itescat’)
1 Me Hitachi sere
itencat
Ac Seeee
Aircoller 12008
tar Re caaad
#3. Create a Pandas Series using Range Function.
Program:
import pandas as pd
s1=pd.Series(range(5))
s2=pd.Series(range(1,6,2))
print(s1)
print(s2)
Output:
#4. Create a data frame for examination result and display row labels,
column labels data types of each column and the dimensions
import pandas as pd
result»pd.DataFrame(dic)
orint(result}
print(result.dtypes)
print(result.shape)
Class Pass-Percentage
Q I 100.8
1 100.8
a 100.0
3 WW 100.8
4 V 108.0
5 VW 102.8
6 VII 100.2
7 Vl 100.2
ee 100.8
9 x 98.6
10 Xl 100.8
11 XII 99.8
Class object
Pass-Percentage floatéé
dtype: object
import pandas as pd
dice{'Name':['Rohit’, ‘Mohit’, Deepak’ ,"Rohit', ‘Deepak’, ‘Sohit’ , Geeta’),
Name MarksinI?
@ Rohit a5
2 Deepak 92
3} Rohit 85
4 Deepak 92
#6. Create a Pandas Series with range and for loop.
Program:
import pandas as pd
s=pd.Series(range(1,15,3),index=[x for x in ‘abcde’])
ss=pd.Series(range(0,5),index=[x for x in ‘abcde’])
print(s)
print(ss)
Output:
#7. Locate the 3 largest values in a data frame.
import pandas as pd
dics{"Niane’:["Ronit’, Mohit’, "Deepak, "Anil", Pankaj’, 'Sohit’, Geeta’),
ane Marksinl?
4 Panka} 38
5 Shit %
2 Deepak 92
#8. Create a Pandas Series for missing values using NaN (Not a
Number)
Program:
import pandas as pd
import numpy as np
Output:
#9. Write a Pandas Series Program to Perform Some of the
Object Attribute Functions.
Program:
import pandas as pd
data=pd.Series(range(1,15,3),index=[x for x in ‘abcde’])
print(data)
print(‘Axis: ',data.axes)
Output:
#10. Create a Pandas Series to perform the Mathematical and
Vector Operations on Series Elements.
Program:
import pandas as pd
$1=pd.Series([11,12,13,14,15])
s2=pd.Series([22,24,23,24,25])
$3=pd.Series([11,12,13,14,15], index=([101, 102,103,104, 105]))
print(‘Addition :’.s1+s2)
print(‘Subtraction :',s2-s1)
print(‘Multiplication :',s1*s2)
print(‘Division :",s2/s1)
print(‘Floor Division :’,s2//s1)
print(‘Modules :",s2%s1)
print('Addition :' 51453)
print("Vector Multiply:',s1*3)
print(‘Vector Multiply:’,s2+10)
print(‘Vector Power:’,s1°*2)
Output:
#11. Importing and exporting data between pandas and CSV file
df = pd.read_csv("E:\emp.cow")
print(d#)
| import pandas as pd
l= [{"Wame’: Sachin’, ‘Sirllane’:Bhardvaj'},
{"Wame’: Vinod’, "Sirliane’:"Veraa’},
: { "Wame': "Rajesh", Sirllame’: Mishra’}]
dflepd.DataFrane(1)
# soving the datafrome
df1.to_csv("E:\Dataframel csv’)
Program:
import pandas as pd
HT=pd.Series((8,10,17,18,19,25,26,30].
index=['a’,'b’,'c’,'d’,'e’, f,'g’,''])
D=pd.Series({1:1.1,2:22,3:33.,4:44,5:5.5,6:66,7:7.7})
print(HT)
print(HT.head())
print(HT .tail())
print(HT.head(3))
print(HT. tail(2))
print(D)
print(D.head(3))
print(D.tail(2))
Output:
#13. Create a Pandas Series to access data from it, with position
(Slicing & Indexing).
Program:
import pandas as pd
s=pd.Series(/1,2,3,4,5],index=['a’,b’,'c’,'d’,’e’])
print(s)
print(s[O])
print(s[‘c’])
print(s[:3])
print(s[-3:])
print(s[1:5])
print(s[2:-2])
Output:
#14. Create a Pandas Series to access elements of series using
‘loc’ and ‘iloc’.
Program:
import pandas as pd
s=pd.Series((1,2,3,4,5],index=['a’,'b’,‘c’,‘d’,'e'))
ss=pd.Series(['a’,'b’,'c’,'d’,'e'],index=[1,2,3,4,5])
print(s.iloc{1:4])
print(s.loc['b’:'e'])
print(ss.iloc[2:5])
print(ss. iloc[2:-2])
Output:
#15. Create a Pandas Series & Retrieve the Data using Some
Conditions
Program:
import pandas as pd
s=pd.Series((1,2,3,4,5],index=['a’,’b’,'c’, d’,'e’])
ss=pd.Series([10,20,30,40,50],index=(1,2,3,4,5])
print(s<10)
print(ss[ss<30])
print(ss[ss==10])
print(ss[ss>=30))
print(ss[ss!=3])
Output:
#16. Create a program for Importing and Exporting Data between
Pandas and CSV File.
Program:
import pandas as pd
print(“\n")
Name=['Mahi’,"Yuvi',Kohii’,"Rohit’,, ABD’]
Degree=['B.E','MBA’,’M. Tech’, MBBS’,M.E]
Score=(490,488,492,496 482]
dict=(‘Name":Name, ‘Degree’-Degree, Score’:Score}
df=pd. DataFrame(dict)
print(" The File 'Exp.CSV* is Created(Imported) “)
df.to_csv(‘Exp.csv)
print(“\n")
df2=pd.read_csv(‘FILE3.csv)
print(“\n")
print(" The File Content of 'FILE3.csv' is Received(Readed)\n *)
df2.index.name='Index_No’
print(df2)
Output:
A a Ge
HM
Mh os
Pad G4
1 AAA
ae eee
Aone)
#17. Given the school result data, analyse the performance of the
students on different parameters, e.g subject wise or class wise.
plt. show(
PASS PERCENTAGE
import natplotlib.pyplot
import numpy as np
plt.bar(x+.5@,per hum, ]
plt.xticks(x,$)
plt.ylabel( ‘Percentage’ )
plt.title( ‘Bar Graph Fe
olt. legend)
plt. show( )
a plt
25, color='red
100
Percentage
lst
== Sierce
= commerce
ee Humanites
Post ror
—J
19. Take Data of your interest from an open source (e.g, data.gov.in),
regate and summarize it. Then plot it using different plotting
unctions of the Matplotlib Library.
Program:
import pandas as pd
import matplotlib.pyplot as pl
cf=pd.read_csv("PEDV.csv")
print(cf,"\n')
s=(cf["Team’].head(12))
$2=(cf['Salary’].head(12))
pl.bar(s,s2)
pl.show()
Output:
a .
ad ™ -— 2 ee
- =
ee « 5
wn. = ” =m =
= = un te
a fae -
a * a Pa
' =
* - - —-
er - =
a . = f
a = 4 a at
ci Ams *
- im
«
= ‘ae
moots 4
ooo 4
0000 |
POOOG 4
Salary Range
#20. Create a student table with the student id, name, and marks as
attributes where the student id is the primary key.
#24, Remove extra spaces from left, right and both sides from the text
- “Informatics Practices Class XII"
Left Spaces
#26. Find the min, max, sum, and average of the marks in a student
marks table.
#27. Find the total number of customers from each country in the table
(customer ID, customer Name, country) using group by.
pPSsesesesess pS SSSS555S45555S55, -
#28. Write a SQL query to display names into capital letters,
small letters, display first 3 letters of name, display last 3
letters of name, display the position the letter A in name
#29, Write a SQL query to order the (student ID, marks) table in
descending order of the marks.
Use OFFICE:
fi = fF ra
Mii
#36. Display the details of all the employees in the ascending
order of their salary and within salary in the descending order
"AM
AMM
Vee
‘al ml al bl at
» Ae
al et ot hl dal
eal e dh) hla
#37. Increase the bonus by 0.5% for all the employees for which
the salary is more than 400000
ub. Ve ;
#38. Add another column Category of type CHAR(S5) in the
Employees table
enployee;
Type
Lit «
H YAP i’
Lint
int
mo ru i dei ima l4 4a ,
: do} | date
| CATEGORY i chart5>)
* *
, Pow Lm et (Mw
#39, Create table fees_ due with columns Admno, month,
Amt_ due.
Select trno, name, class, sex, month, amt_ due from students, fess due
Where student.admno=fees_due.admno;
#41. Display city and highest marks of students of each city, but only
for Delhi and Mumbai in descending order of city.