Informatics Practices Record Class 12
Informatics Practices Record Class 12
RECORD
ACADEMIC YEAR : 2023-24
NAME:
CLASS:
SUB CODE:065
INDEX
S.NO DATE PROGRAMS PAGE NO SIGNATURE
Pythonprogramtofindthe
sum,average,min,max,count of weekly
13/5/2023 expenses of
7.
series s1 using pandas and finally sort the
given series into new series S2
percentage.
DATA VISUALIZATION
MYSQLQueriestoimplementMath
function,text function,date and time
30. 16/9/2023 function
CODING:
import pandas as pd
for i in range(0,n):
print("Thanks for entering the data") print("The list of dictionaries is:") print(l1)
OUTPUT:
CODING:
import pandas as pd
OUTPUT:
CODING:
import pandas as pd
OUTPUT:
CODING:
import pandas as pd
OUTPUT:
CODING:
import pandas as pd
print("")
print(ds) print(type(ds))
print(type(ds.tolist()))
OUTPUT:
CODING:
import pandas as pd
ds1= pd.Series([12,14, 26, 18,10])
ds3= pd.Series([89,67,2])
ds = ds1 + ds2
print(ds)
ds = ds1 + ds3
print(ds)
print(ds)
print(ds)
print(ds)
OUTPUT:
CODING:
import pandas as pd
IND=["MON-EXP","TUE-EXP","WED-EXP","THU-EXP","FRI- EXP","SAT-EXP"]
s1= pd.Series([100.5,200.8,78,92,300.12,400],index=IND)
print(s1)
OUTPUT:
CODING:
print(s) res=s.quantile(q=0.75)
OUTPUT:
CODING:
99,98,100,98.6,97.2,99,100,97.9,100,100,99,100],
“TOPPER":["RAM","SHYAM","RAHUL","CHRISTOPHER","ROOPALI","V
ENKAT","KUMAR","SAHEEL","SALIM","POOJA","ANIL
KUMAR","GEETHA"],"NO-OF-STUDENTS”:
[230,450,390,412,290,300,234,345,213,300,112,111]}
result=pd.DataFrame(dic)
CODING:
df=pd.DataFrame(dic)
OUTPUT:
CODING:
'Divya','Anjali',"Kavitha"],
CODING:
import pandas as pd
"CATHARINE","DERRICK"],"MARKS1":[80,90,20,50],
"MARKS2":[82,91,30,40], "MARKS3":[91,95,80,70]}
for i in df.index:
m1 = df.iloc[i]["MARKS1"]
m2 = df.iloc[i]["MARKS2"]
m3 = df.iloc[i]["MARKS3"] total = m1+m2+m3
per = total/3
print("")
OUTPUT:
CODING:
import pandas as pd dct = {"AdmNo":
[1024,2031,1233,4342],"Name":['Aman','Rahul',
'Saurab','Zoya'],
print(df)
OUTPUT:
CODING:
CHE=[]
BIO=[]
ENG=[]
IP=[]
SD['ENG']=ENG SD['INFO_PRACTICES']=IP
SD['Total']=SD.PHY+SD.CHEM+SD.BIO+SD.ENG
+SD.INFO_PRACTICES
SD['Per']=SD.Total/5 print(SD)
OUTPUT:
CODING:
d={}
df1=pd.DataFrame(l1)
print(df1)
OUTPUT:
OUTPUT:
OUTPUT:
CSV FILE WHICH IS IMPORTED :
EXPORTED DATA FROM DATAFRAME IS SAVED IN THE FOLLOWING CSV FILE:
CODING:
#python program to transfer the data from dataframe to mysql table
m=[{"rno":100,"studname":"hariharan","fees":10000},
{"rno":101,"studname":"geetha","fees":20000},
{"rno":102,"studname":"simran","fees":14000}] df1=pd.DataFrame(m)
print(df1) mydb =
mysql.connector.connect(host="localhost",user="root",
passwd="123456",database="IP12")
OUTPUT:
MYSQL TABLE STUD:
CODING:
print(df2) mydb =
mysql.connector.connect(host="localhost",user="root",
passwd="123456",database="IP12")
print(mydb)
mydb.commit() mydb.close()
OUTPUT:
MYSQL TABLE CONTENT:
CODING:
import pandas as pd
{"2017":[82.0,81.5,81.8,78.5],
"2018":[83.0,71.5,92.4,88.5],
"2019":[92.0,81.9,85.8,90.5],
“2020":[98.2,89.3,92.9,99.0]},
index=["ECO","ACC","BST","IP"])
plotdata.plot(kind="bar")
OUTPUT:
CODING:
x=np.arange(len(toppers))
plt.bar(x,ECO_PER,width=0.15,color="y",label="ECONOMICS")
plt.bar(x+0.15,ACC_PER,width=0.15,color="m", label="ACCOUNTANCY")
plt.bar(x+0.30,BST_PER,width=0.15,color="g", label="BUSINESS-STUDIES")
plt.legend() plt.show()
OUTPUT:
CODING:
#program to plot horizontal bar graph and save the graph import numpy as np
y_pos=np.arange(len(lang)) performance=[8,11,15,23,12,10]
plt.barh(y_pos,performance,color="cyan") plt.title("PROGRAMMING LANGUAGE
USAGE")
plt.savefig("E:\Plang.jpg") plt.show()
OUTPUT:
CODING:
OUTPUT:
CODING:
plt.plot(x,y1,linestyle="solid",marker="d",color="red",lab el="april")
plt.plot(x,y2,linestyle="dashed",marker="s",color="blue",l abel="may")
plt.plot(x,y3,linestyle="dashdot",marker="^",color="green"
,label="june") plt.plot(x,y4,linestyle="dotted"
plt.legend() plt.show()
OUTPUT:
CODING:
import pandas as pd
import matplotlib.pyplot as plt import random
commutes=[]
print(commutes) plt.hist(commutes,bins=8,color='yellow',edgecolor="red")
plt.title('Commute Times for 100 Commuters') plt.xlabel('Counts')
OUTPUT:
CODING:
plt.bar(df["State_UT"],df["Higher_Secondary_Total"]) plt.xticks(n,state,rotation=90)
CLASSES",fontsize=8) plt.subplot(132)
CLASSES",fontsize=8)
plt.plot(df["State_UT"],df["Secondary_Total"],marker="s",m
arkeredgecolor="blue",linestyle="solid")
plt.xticks(n,state,rotation=90)
plt.subplot(133)
CLASSES",fontsize=8) states=(df["State_UT"].head(6))
plt.pie(df["Primary_Total"].head(6),labels=states,autopct= "%0.1f%%")
Name varchar(30)
Marks decimal(4,1)
DOB date
QUERY:
DATABASE CREATION:
TABLE CREATION:
26. To write MYSQL Queries to insert the given set of records
QUERY:
AFTER INSERTION – CONTENTS OF STUDENT TABLE :
a. Write a SQL query to delete the students whose marks is null
BEFORE DELETE:
DELETE QUERY:
AFTER DELETE:
a. Write a SQL query to delete the records whose student name have “I” as 4th character
BEFORE DELETE:
DELETE QUERY :
AFTER DELETE:
a. Write a SQL query to change the marks of “Manab Das “ to 82
Before UPDATE:
UPDATE QUERY:
After UPDATE:
a. Write a SQL query to change the name of “Nidhi Sharma” to “Nidhi”
BEFORE UPDATE:
UPDATE QUERY:
AFTER UPDATE:
a. Write a SQL query to display roll numbers and marks of students who have secured
marks in the range 70 to 80 (including 70 and 80).
a.
a. Write a SQL query to display rows from the table Student with names starting with 'A'.
a.
a. Write a SQL query to order the (student ID, marks) table in descending order of the
marks.
a. Write a SQL query to sort all the records in descending order of StudentID and the
ascending order of DOB
a. Write a SQL query to display name and student_ID whose marks is not null
a. Write a SQL query to display name whose marks is either 87 or 76 or 94.Use(IN)
a. Write a SQL query to find the highest marks obtained by any student.
a.
a. Write a SQL query to find the lowest marks obtained by a male student.
a. Write a SQL query to find the average marks obtained by female students.
a. Write a SQL query to find the total number of male and female students in Student
table.
a. Write a SQL query to find the number of students gender wise whose count
should be greater than 5
a. Write a SQL query to round the given number to 2 decimal places .(298.348,2)
a. Write a SQL query to find the modulus value 89%5.
a. Write a SQL query to extract form from the string “INFORMATICS PRACTICES”using
substring and mid function.
a. Write a SQL query to find the position of “O” in the string “INFORMATICS PRACTICES”using
Instr function.
a.