Ip Practical 2024
Ip Practical 2024
Ip Practical 2024
DataFrame (15/07/2024)
Iteration on Rows and Columns
iterrows ()
OUTPUT
11.CSV (20/07/2024)
12.DataFrame (22/07/2024)
iteritems ()
OUTPUT
13.DataFrame (24/07/2024)
Program for iteration
14.CSV (27/07/2024)
Write a program to read details such as Item, Sales made in a DataFrame and then store this
data in a CSV file.
SOURCE CODE
import pandas as pd
data = {'Item': ['Apple', 'Banana', 'Orange', 'Grapes'],'Sales': [100, 150, 80, 120]}
df = pd.DataFrame(data)
Output
Item,Sales
Apple,100
Banana,150
Orange,80
Grapes,120
15.Bargraph(29/07/2024)
OUTPUT
16.LIne plot(31/07/2024)
A line plot/chart is a graph that shows the frequency of data occurring along a number line.
The line plot is represented by a series of datapoints connected with a straight line.
Generally line plots are used to display trends over time. A line plot or line graph can be
created using the plot() function available in pyplot library. We can, not only just plot a line
but we can explicitly define the grid, the x and y axis scale and labels, title and display options
etc
import numpy as np
import matplotlib.pyplot as plt
year = [2014,2015,2016,2017,2018]
jnvpasspercentage = [90,92,94,95,97]
kvpasspercentage = [89,91,93,95,98]
plt.plot(year, jnvpasspercentage, color='g')
plt.plot(year, kvpasspercentage, color='orange')
plt.xlabel(‘Year')
plt.ylabel('Pass percentage')
plt.title('JNV KV PASS % till 2018')
plt.show()
OUTPUT
Note:- As many lines required call plot() function multiple times with suitable
arguments.
17.Histogram(03/08/2024)
A histogram is a graphical representation which organizes a group of data points into user-
specified ranges.
Histogram provides a visual interpretation of numerical data by showing the number of data
points that fall within a specified range of values (“bins”). It is similar to a vertical bar graph
but without gaps between the bars.
SOURCE CODE
import numpy as np
import matplotlib.pyplot as plt
data = [1,11,21,31,41]
plt.hist([5,15,25,35,45, 55], bins=[0,10,20,30,40,50, 60], weights=[20,10,45,33,6,8],
edgecolor="red")
plt.show()
OUTPUT
18.Math Functions(05/08/2024)
1. POWER ()
2. ROUND ()
3. MOD ()
19.Text Functions(07/08/2024)
20.Date Functions(12/08/2024)
1. NOW ()
2. DATE ()
3. MONTH ()
4. MONTHNAME()
5. YEAR ()
6. DAY ()
7. DAYNAME()
21.Student Table (15 Queries) (14/08/2024)
Solution:
1 Create table:
2 Insert records:
insert into students values
(1, 'Naman', 'XII','1995/05/09','M','Anand',453)
Insert all records simimlarly.
3 display the detail of class XII students in descending order of their marks
select * from students order by marks desc;
6 Count the students class wise is display only those number who is more than 2
select class,count(*) from students group by class having count(*)>2;
12 IP KV PANGODE /SKV