Professional Documents
Culture Documents
SCHOOL
GOKALPUR VILLAGE
SACHIN MAURYA
-Data Handling
1. Create a panda's series from a dictionary of values and a ndarray
2. Given a Series, print all the elements that are above the 75th
percentile..
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 print the total expenditure per category.
4. Create a data frame for examination result and display row
labels, column labels data types of each column and the dimensions
5. Filter out rows based on different criteria such as duplicate rows.
6. Importing and exporting data between pandas and CSV file
-Visualization
7. Given the school result data, analyses the performance of the
students on differentparameters, e.g subject wise or class wise.
8. For the Data frames created above, analyze, and plot appropriate
charts with title andlegend.
9. Take data of your interest from an open source (e.g. data.gov.in),
aggregate andsummarize it. Then plot it using different plotting
functions of the Matplotlib library.
-Data Management
10. Create a student table with the student id, name, and
marks as
attributes where thestudent id is the primary key.
11. Insert the details of a new student in the above table.
12. Delete the details of a student in the above table.
13. Use the select command to get the details of the students with
marks more than 80.
14. Find the min, max, sum, and average of the marks in a student
marks table.
15. Find the total number of customers from each country in the
table
(customer ID,customer Name, country) using group by.
16. Write a SQL query to order the (student ID, marks) table in
descending
DATA HANDLING
1. Create a panda's series from a dictionary of values and a
ndarray
INPUT:-
import pandas as pd
import numpy as np
s=pd.Series(np.array([2,4,5,7,9,8,9]))
print(s)
Output:
02
14
25
37
49
58
69
dtype: int32
>>>
2:Given a Series, print all the elements that are
above the 75th percentile.
INPUT:-
01
14
26
37
48
59
6 11
dtype: int32
Output:
Output:
class pass_percentage
0 I 100.0
1 II 100.0
2 III 100.0
3 IV 100.0
4 V 100.0
5 VI 100.0
6 VII 100.0
7 VIII 100.0
8 IX 96.0
9 X 99.1
10 XI 98.0
11 XII 97.7
class object
pass_percentage float64
dtype: object
shape of the dataframe is :
(12, 2)
>>>
5:Filter out rows based on different criteria such as
duplicate rows.
INPUT:-
'''Python program to Filter out rows based
on different criteria such as duplicate rows'''
import pandas as pd
dic={'Name':['Ajay','Banti','Chandrkant','Deepak','Geeta','Harshit'],
'CS_Marks':[80,78,80,92,78,99]}
marks=pd.DataFrame(dic)
print(marks)
#Finding duplicate rows
print("Duplicate Rows : ")
duplicateRow = marks[marks.duplicated('CS_Marks',keep=False)]
print(duplicateRow)
Output:
CS_Marks Name
0 80 Ajay
1 78 Banti
2 80 Chandrkant
3 92 Deepak
4 78 Geeta
5 99 Harshit
Duplicate Rows :
CS_Marks Name
0 80 Ajay
1 78 Banti
2 80 Chandrkant
4 78 Geeta
>>>
6:Importing and exporting data between pandas and CSV
file.
INPUT:-
'''Importing data between pandas and CSV file'''
import pandas as pd
#make data frame
df=pd.read_csv("d:\std.csv")
print(df)
Output:
Output:
8:For the Data frames created above, analyze, and plot
appropriate charts with title and legend.
INPUT:-
p10
9:Take data of your interest from an open source (e.g.
data.gov.in), aggregate and summarize it. Then plot it
using different plotting functions of the Matplotlib
library.
INPUT:-
import pandas as pd
import matplotlib.pyplot as plt
dframe=pd.read_csv("D:\Covid_Vaccine.csv")
print(dframe)
Output:
import pandas as pd
import matplotlib.pyplot as plt
dframe=pd.read_csv("D:\Covid_Vaccine.csv")
slices=(dframe['TOTAL DOSES ADMINISTERED'].head(6))
states=(dframe['STATE/UTS'].head(6))
colours=['c','b','y','m','r','gold']
exp=[0,0,0,0,0,0.1]
plt.pie(slices, labels=states, colors=colours, startangle=90,
explode=exp, shadow=True, autopct='%.1f%%')
plt.title('Vaccine Adminstrated ')
plt.legend()
plt.show()
Output:
DATA MANAGEMENT
1. Create a student table with the student id, name, and
marks as attributes where the student id is the primary key.
CREATE TABLE Student
( STUDENT_ID INT PRIMARY KEY, STUDENT_NAME VARCHAR(25), MARKS INT );
IP PRACTICAL FILE 12
-END OF FILE-
BY:-AYAN ALI.