INFORMATIC
PRACTICES
PRACTICAL
FILE
2024-25
SUBMITTED BY:
Name: Akshita
Class: XII-C
Roll Number:
Subject code: 065
ACKNOWLEDGEMNET
I would like to express my sincere gratitude to
my teacher Ms. Pooja Negi for her vital support,
guidance and encouragement without which this
practical would not come forth from my side.
Who helped me completing the project by giving
ideas, thoughts and made this practical easy and
accurate.
I wish to thank my parents for their undivided
support and interest who inspired me and
encouraged me to go my own way, without which
I would be unable to complete my practical.
CERTIFICATE
This is to certify that Akshita,
Student of class XII-C had
successfully completed the
Practical of INFORMATIC
PRATICES under the guidance
of Ms. Pooja Negi.
Teacher’s signature:
External Examiner’s signature:
INDEX
SNO. CONTENT
1. Creating dataframe from a list
2. Creating panda series
3. Filtering out rows
4. Attribute functions
5. Series for missing values using NaN function
6. Series using Range Function
7. Slicing and Indexing
8. Importing & exporting data between CSV files
9. Creating series usinf ‘loc’ & ‘iloc’
10 Using head() & tail() function
.
11 Creating series from list
.
12 Retrieving the data
13 Creating dataframes
.
14 Storing details of employees
.
15 Visualization of school result data
.
16 Plotting functions in matplotlib library
.
17 Plotting a line chart
.
18 Plotting histogram
.
19 Plotting functions in matplotlib library
.
20 Arranging the data in descending order
.
21 Displaying the total salary
.
22 Displaying the department names according to
the query
.
23 Sum of all employees grouped department wise
.
24 Displaying remainder
.
25 Using round function
.
26 Using lcase function
.
27 Displaying length of the table
.
29 Using ‘LEFT’ function
.
30 Using ‘RIGHT’ function
.
31 Displaying month of DOA
.
32 Day name of DOA
.
33 Displaying joining year of IP students
.
34 Name of students who joined in June
.
#1. Create a dataframe from a list containing 2
lists, each containing target and actual sales
figures of four zonal offices.
Import pandas as pd
Target= [56000, 70000, 75000, 60000]
Sales= [58000, 68000, 78000, 61000]
ZonalSales=[Target, Sales]
zsalesDf= [Link](ZoneSales, columns=
[‘ZoneA’, ‘ZoneB’, ‘ZoneC’, ‘ZoneD’], index=[‘Target’,
‘Sales’])
Print(zsalesDf)
Output:
#2 Create a panda series using Range function
Program:
Output:
#3 Filter out rows based on different criteria
such as duplicate rows.
Program:
Output:
#4 Write a Pandas Series Program to Perform
Some of the Object Attribute Functions.
Program:
import pandas as pd
data=[Link](range(1,15,3),index=[x for x in 'abcde'])
print(data)
print('Has NaNs: ',[Link])
print('Shape : ',[Link])
print('Data Type : ',[Link])
print('Dimension : ',[Link])
print('Index Value : ',[Link])
print('[Link] Bytes: ',[Link])
print('Values in Series: ',[Link])
print('Size : ',[Link])
print('Series Empty: ',[Link])
print('Axis: ',[Link])
Output:
#5. Create a Pandas Series for missing values
using NaN(Not aNumber)
Program:
import pandas as pd
import numpy as np
s=[Link]([7.5,4,4.5,[Link],-34.5])
print(s)
Output:
#6 . Create a Pandas Series with range and for
loop.
Program:
import pandas as pd
s=[Link](range(1,15,3),index=[x for x in 'abcde'])
ss=[Link](range(0,5),index=[x for x in 'abcde'])
print(s)
print(ss)
Output:
#7 Create a Pandas Series to access data from it,
with position (Slicing & Indexing).
Program:
import pandas as pd
s=[Link]([1,2,3,4,5],index=['a','b','c','d','e'])
print(s)
print(s[0])
print(s['c'])
print(s[:3])
print(s[-3:])
print(s[1:5])
print(s[2:-2])
Output:
#8 Importing and exporting data between pandas
and CSV file.
Program:
Import pandas as pd
Df= pd.read_csv(‘your_file.csv’) Print(df)
Output:
#9 . Create a Pandas Series to access elements of
series using ‘loc’ and ‘iloc’.
Program:
Import pandas as pd
ss=[Link](['a','b','c','d','e'],index=[1,2,3,4,5])
print([Link][1:4])
print([Link]['b':'e'])
print([Link][2:5])
import pandas as pd
s=[Link]([1,2,3,4,5],index=['a','b','c','d','e'])
print([Link][2:-2])
Output:
#10. Create a Pandas Series using Head () and
Tail () Functions.
Program:
Import pandas as pd
Data= [10, 20, 30, 40, 50, 60, 70, 80, 90,100]
Series= [Link](data)
Print(“Head of the series:”)
Print([Link]())
Print (“/nTail of the series:”)
Print([Link]())
Output:
#11 To write a Python program to create a Series
using list and display the following attributes of the
Series: (i) index (ii) dtype (iii) size (iv) shape (v)
hasnans
Program:
Output:
#12 Create a Pandas Series & Retrieve the Data
using Some Conditions
Program:
import pandas as pd
s=[Link]([1,2,3,4,5],index=['a','b','c','d','e'])
ss=[Link]([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:
#13 To write a Python program to create a
panda’s DataFrame called DF for thefollowing
tableusing Dictionary of List and display the
details of students whose Percentage is more
than85.
Program:
Output:
#14 To Write a Python program to store the
details of Employess’ such as Empno,
Name,Salary into a [Link] file. Also, write
a code to read employee details from csvfile.
Program:
Output:
#15. . Given the school result data, analyse the
performance of the students on different
parameters, e.g subject wise or class wise.
Program:
#16. For the Data frames created above, analyze and
plot appropriate charts with title and legend.
Program:
Output:
#17. To write a Python program to plot a Line chart to
depict the changing weekly Onionand Brinjal prices for
four weeks. Also, give appropriate axes labels, title and
keep markerstyle as Diamond andmarker edge color as
‘red’ for Onion.
Program:
Output:
#18. To write a Python program to plot a Histogram
for the following class interval orrange. Also, give
appropriate axes name, title and edegecolor as ‘red’.
Program:
Output:
#19. Take Data of your interest from an open source
(e.g, [Link]),aggregate and summarize it. Then
plot it using different plotting functions of the
Matplotlib Library.
Program:
import pandas as pd
import [Link] as pl
cf=pd.read_csv("[Link]")
print(cf,'\n')
s=(cf['Team'].head(12))
s2=(cf['Salary'].head(12))
[Link](s,s2)
[Link]('Name of the Team', fontsize=18)
[Link]('Salary Range', fontsize=18)
[Link]('Aggregated and Summarized
Data',fontsize=22) [Link](‘Salary’, loc=’best’)
[Link]()
Referring the following table to
execute the codes:
#20Write the query to list names of employees in
Descending order.
Program:
SELECT NAME FROM INFO ORDER BY NAME DESC;
Output:
#21 write a query to find out the total salary of all
employees.
Program:
SELECT SUM(SALARY) FORM INFO;
Output:
#22 write a query to display the maximum salary and
minimum salary of employees.
Program:
SELECT MAX(SALARY), MIN(SALARY) FROM INFO;
Output:
#23 write a query to display the department names
where number of employees are greater than or equal
to 2.
Program:
SELECT DEPT FROM INFO GROUP BY DEPT HAVING COUNT(*)>=2;
Output:
#[Link] a query to display the sum of the employees
grouped by department wise.
Program:
SELECT DEPT, SUM(SALARY) FROM INFO GROUPED BY DEPT:
Output:
Referring to the table given
below for (SQL functions)
#25 write a query to display Remainder of column
Percentage divide by 3.
Program:
SELECT MOD(MARKS,3) FROM STU;
Output:
#26 write a query to display student names and their
percentage in round figure.
Program:
SELECT NAME, ROUND(PERCENTAGE,0) FROM STU;
Output:
#27 Write a query to display department name in
lower case letters.
Program:
SELECT LCASE(DEPT) FROM STU;
Output:
#28. Write a query to display department name and
it’s respective number of characters in Dept column.
Program:
SELECT DEPT, LENGTH(DEPT) FROM STU;
Output:
#29. Write a query to display first 2 characters of the
column name.
Program:
SELECT LEFT(NAME,2) FORM STU;
Output:
#30 write a query to display first 2 characters of the
column Name.
Program:
Select RIGHT(NAME,2)FROM STU;
Output:
#31. write a query to display name and month of date
of admission of all students.
Program:
SELECT NAME, MONTH(DOA) FROM STU;
Output:
#32. write a query to display name and day name of
the student’s DOA from the table STU.
Program:
SELECT NAME, DAYNAME(DOA) FROM STU;
Output:
#33. Write a query to display the joining year of IP
students.
Program:
SELECT YEAR(DOA) FROM STU YEAR WHERE DEPT=’IP’;
Output:
#38. Write a query to display the name of the
students who joined in the month of June.
Program:
SELECT NAME FROM STU WHERE MONTHNAME(DOA)=’JUNE’;
Output: