1.
create a pandas series from a dictionary of values and an array
Using dictionary of values:-
Output:-
Using ndarray:-
Output:-
2. Create a dataframe 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 .
let the dataframe be:-
Item category Item name Expenditure
snack bourbon 100
hygenic product colgate 125
snack oreo 80
fruit apple 300
hygenic product dettol 50
code:-
output:-
3. Create a dataframe for examination result and display row labels, column
labels, data types of each column and the dimensions
let the dataframe be :-
name english ip math
swastik 96 99 100
rajesh 90 98 100
rohit 80 97 100
anup 92 96 100
code:-
Output:-
4. Filter out rows based on different criteria such as duplicate rows,
english ip math total mark
swastik 100 100 100
rajesh 59 90 90
rohit 80 97 65
anup 92 96 79
khan 100 100 100
Code:-
Output:-
5. importing and exporting data between pandas and csv file
code:-
Output:-
6. Given the school result data ,analyze the performance of the student on the
different parameters e.g.,subject-wise.
let the dataframe be:-
name class roll on. english ip math total mark
0 rajesh XII 33 100 90 82 242
1 rohit X 34 59 99 91 286
2 anup XI 60 80 82 90 242
3 swastik XII 25 96 95 94 285
Code:-
Output: -
7. Use the above row and filter the data class wise .
code:-
Output:-
8. How to swap two columns in a 2d numpy array?
code:-
output:-
9. How to print only 3 decimal places in a python numpy array?
code:-
output:-
10. How to compute the mean, median, standard deviation of a numpy array?
code:-
output:-
11. Write a complete Program to show database connectivity of python Data
Frames with mysql database using Student table with all operations involved in
the Result Management System.
code:-
output:-
12. Write a program to iterate and print a dataframe column-wise of first 3
columns , row-wise of list 2 rows and item-wise 2 at a time from a csv file
let the dataframe be:-
code:-
Output:-
13. Write a program to delete the records of those students who scored less
than 33%
code:-
Output:-
14. Write a program to read a csv file containing names and marks of the
students, then add a column name “total_mark”, “grade”, then grade then as
per marks as given below and save it as a csv file.
mark>=90 A+
mark 70-90 A
mark 60-70 B
mark 50-60 C
mark 40-50 D
mark<40 E
let the csv file be:-
code:-
Output:-
The new csv file is :-
15. Plot two weighted histogram using subplot function.
code:-
output:-
16. Plot a line chart from a csv file with different line style and save the figure .
let the csv file be:-
code:-
output:-
17. Plot line chart with different marker style from a dataframe and
save the figure .
code:-
output:-
18. Plot BAR graphs with different colours and save the figure.
code:-
output:-
19. Plot a line graph using a equation y=x**2 and a histogram in a same figure
code:-
output:-
20. Create a database named as ‘JIS’ and use it.
21. Create a table ‘EMPLOYEE’ with having some related and
useful attributes.
22. Display name, job and salary of those employees who are
not getting any commission.
23. Display name, job and salary of those employees who are
not getting any commission.
24. Display the name, job, salary and commission of all
employees by providing a message
‘NO COMMISSION’ in place of NULL value of COMM
column.
25. Display job, name, salary and commission of all
employees by arranging job in ascending order and salary in
descending order.
26. Display name, salary, commission and total salary which
should be the sum of salary and commission with a new
column heading ‘NET SALARY’ of those employees who are
getting commission.
27. increase the commission by 500 rupee of those
employees who are getting commission.
28. Delete the records of those employes who are neither
getting salary nor getting any commission.
29. Display employee Name in upper case and job in lower
case format of those employees whose name starts with
alphabet ‘S’.
30. Add a new column ‘REGD_NO’ of String type as the first
column of the EMPLOYEE table and then display the proof by
representing the structure of the table.
31. Display the name of those employees whose name
contain odd number of characters.
32. Display employee name and year of joining with a new
alias name ‘JOINING YEAR’ of those employees who has
either joined in the year 1987 or 2021;
33. Display employee name, job and salary of those
employees whose salary amount is divisible by 100.
34. Display job and total number of employees working
belongs to each group of job.
35. Display job and total number of employees working
belongs to each group of job where number of employees
not more than 2.
36. Display job and total expenditure towards salary for each
group of job of all employees.
37) OPERATION ON RELATIONS
Perform the UNION peration
38) Table Joining :
a). Write MYSQL command to represent the INNER JOIN by
using the above two tables.
b). Represent a right outer join by using the above two tables.