Python Programs
Python Programs
programs
30 programs
INDEX
I. To create a series from two different lists.
II. To perform indexing, slicing and accessing data from a
series
III. Usage of loc and iloc for accessing elements of a series.
IV. To create a student CSV file from Dataframe.
1|Page
XVI. To calculate mean of every single row containing
numeric value in the dataframe
XVII. To calculate median of the dataframe
XVIII. To implement pivoting using pivot() method for result
dataframe
XIX. Sort the python pandas Dataframe given below on the
basis of a single column in descending order.
XX. To implement groupby() by grouping all the
recordsbased on age and displaying the maximum age
amongst each age group.
XXI. Get the maximum value of all the columns in pandas
dataframe.
XXII. To add legends,titles and labels to a line plot with
multiple lines.
XXIII. Program to plot a quadratic equation using dashed line
chart.
XXIV. To create and open "Employee.csv" file using Pandas.
XXV. To plot lines with different styles using plot () function.
XXVI. To plot a multiple bar chart for section wise students
through pandas dataframe.
XXVII. To plot a simple bar chart orange in colour.
XXVIII. To plot a bar chart horizontally.
XXIX. To plot a histogram using plot () method with 'hist'
argument.
XXX. To plot temperature for 3 consecutive weeks using
a line chart.
2|Page
Program 1. To create a series from two
different lists.
3|Page
Program 2. To perform indexing, slicing and
accessing data from a series.
4|Page
Program 3. Usage of loc and iloc for
accessing elements of a series.
5|Page
Program 4. To create a student CSV file from
Dataframe.
6|Page
Program 5. To illustrate the working of head
() and tail () function on a series.
7|Page
Program 6. To create dataframe from two
series of student data.
8|Page
Program 7. To sort the data of student
dataframe based on marks
9|Page
Program 8. Create a dataframe student with
columns such as name of the students,
students marks in subjects IP and BST. Also,
rename the column Name as Nm and IP as
Informatics Practices.
10 | P a g e
Program 9. Illustrate head () and tail()
methods in an Employee dataframe.
11 | P a g e
Program 10. Program to concatenate two
dataframes.
12 | P a g e
Program 11. To get maximum value of all the
columns in pandas dataframe
13 | P a g e
Program 12. To get minimum value of all the
columns in pandas dataframe
14 | P a g e
Program 13. To get the total sum of
column 'Score'
15 | P a g e
Program 14. To get the total number of
entries for 'Name' column
16 | P a g e
Program 15. To calculate mode of the
dataframe
17 | P a g e
Program 16. To calculate mean of every
single row containing numeric value
in the dataframe
18 | P a g e
Program 17. To calculate median of the
dataframe
19 | P a g e
Program 18. To implement pivoting using
pivot() method for result dataframe
20 | P a g e
Program 19. Sort the python pandas
Dataframe given below on the basis of a
single column in descending order.
21 | P a g e
Program 20. To implement groupby() by
grouping all the recordsbased on age and
displaying the maximum age amongst each
age group.
22 | P a g e
Program 21. Get the maximum value of all
the columns in pandas dataframe.
23 | P a g e
Program 22. To add legends,titles and labels
to a line plot with multiple lines.
24 | P a g e
Program 23. Program to plot a quadratic
equation using dashed line chart.
25 | P a g e
Program 24. To create and open
"Employee.csv" file using Pandas.
26 | P a g e
Program 25. To plot lines with different
styles using plot () function.
27 | P a g e
Program 26. To plot a multiple bar chart
for section wise students through
pandas dataframe.
28 | P a g e
29 | P a g e
Program 27. To plot a simple bar chart
orange in colour.
30 | P a g e
Program 28. To plot a bar chart horizontally.
31 | P a g e
Program 29. To plot a histogram using plot ()
method with 'hist' argument.
32 | P a g e
Program 30. To plot temperature for 3
consecutive weeks using a line chart.
33 | P a g e
34 | P a g e
SQL
QUERY
40 query
35 | P a g e
Table – 1
Consider the given table schoolbus and
answer the questions.
36 | P a g e
(ii) To show area_covered for buses covering more
than 20 km., but charges less than 80000.
37 | P a g e
(iv) To show rtno, area_covered and average cost per
student for all routes where average cost per student
is --- charge / no of students.
38 | P a g e
(vi) Select sum(distance) from school bus where
transporter= "Yadav travels";
39 | P a g e
(viii) Select avg(charges) from school bus where
transporter = "Anand travels";
40 | P a g e
Table – 2
Q. Consider the CUSTOMERS table having
the following records:
41 | P a g e
(b) Write an SQL query to display all records in
descending order of name.
42 | P a g e
(d) Write an SQL query to display maximum salary.
43 | P a g e
(g) Write an SQL query to display average salary.
44 | P a g e
(j) Write an SQL query to display details of those
persons whose age is less than the average age
45 | P a g e
Table – 3
Q. Consider the following EMP and DEPT
tables:
46 | P a g e
(b) Count the number of clerks in the organization.
47 | P a g e
(d) Count the number of employees who are not
getting commission.
48 | P a g e
(g) Display the maximum salary of employees in each
department.
49 | P a g e
Table – 4
Q. Consider the following table and
answer the questions that follow.
50 | P a g e
(b) To list the names of female teachers of Hindi
department.
51 | P a g e
(d) To count the number of teachers in English
Department.
52 | P a g e
(g) select count(*) from TEACHER where
Category='PGT';
53 | P a g e
(j) Write a query to display the names of the female
teachers.
54 | P a g e
(m) Write a query to remove all the records of PGT
teachers.
55 | P a g e