RASHTRIYA INDIAN MILITARY COLLEGE, JULY TERM, 2024
PRACTICAL FILE
Informatics Practices
Submitted To Submitted By
Manoj Kumar Nama Name:
Roll No:
Index
List of Experiments
S No Name of Experiment Page No
Practical Assignment
Experiment No. 1:
Write Python code to create a Series object Temp2 storing temperatures of seven
days of week. Its indexes should be 'Sunday', 'Monday',... 'Saturday'.
Experiment No. 2:
Shubham, a Data Analyst with a multinational brand has designed the DataFrame
df that contains the four quarters' sales data of different stores as shown below :
Answer the following questions :
(i) Predict the output of the following Python statement :
(a) print([Link])
(b) print(df[1:3])
(ii) Delete the last row from the DataFrame.
(ii) Write Python statement to add a new column Total_Sales which is the
addition of all the 4 quarter sales.
Experiment No. 3:
PQR is a list having three lists inside it. It contains summarized data of three
different trials conducted by company A. create a bar chart that plots these three
sublists of ABC in a single chart. Keep the width of each bar as 0.25.
XYZ = [[5, 25, 45, 20], [4, 23, 49, 17], [6, 22, 47, 19]]
Experiment No. 4:
Write a program to iterate over a dataframe containing names and marks which
then calculates grades as per marks(as per guiding below) and adds them to the
grade column.
Marks>= 95 grade A+ ; Marks 50-60 grade C;
Marks 70-90 grade A ; Marks 40-50 grade D;
Marks 60-70 grade B ; Marks <40 grade F
Experiment No. 5:
Given a series nfib that contains reversed Fibonacci numbers with Fibonacci
numbers as shown below:
[0, -1, -1, -2, -3, -5, -8, -13, -21, -34, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
Write a program to plot nfib with following specifications:
(a) The line color should be magenta.
(b) The marker edge color should be black with size 5.
(c) Grid should be displayed.
Experiment No. 6:
Write a program to create three different Series objects from the three rows of a
DataFrame df.
Experiment No. 7:
Experiment No. 8:
Create an array, A, in the range 1 to 20 with values 1.25 apart. Another array,
B, contains the log values of the elements in the array A.
Write a program to create a scatter plot of first vs. second array (array A vs. B)
with red circle markers; specify the x-axis (containing first array’s values) title
as ‘Random Values’ and y-axis title as ‘Logarithm Values’.
Experiment No. 9:
Experiment No. 10:
Write a python program to draw line charts from the given financial data of
XYZ Co. for 5 days in the form a DataFrame namely fdf as shown below:
Day1 Day2 Day3 Day4 Day5
0 74.25 56.03 59.30 69.00 89.65
1 76.06 68.71 72.07 78.47 79.65
2 69.50 62.89 77.65 65.53 80.75
3 72.55 56.42 66.46 76.85 85.08
Experiment No. 11:
Write a Pandas program to convert a dictionary to a Pandas series.
Sample dictionary: d1 = {'a': 100, 'b': 200, 'c':300}
Experiment No. 12:
Write a program to print a DataFrame one row at a time and print only first five
rows.
Experiment No. 13:
Experiment No. 14:
Experiment No. 15:
Experiment No. 16:
Experiment No. 17:
Experiment No. 18:
Given an ndarray p as ([1, 2, 3, 4]). Write code to plot a bar chart having bars for p
and p**2 (with red colour) and another bar for p and p*2 (with blue colour).
Experiment No. 19:
Create a panda’s series from a dictionary of values and a ndarray.
Experiment No. 20: Consider the following tables
Apply the Referential Integrity Constraint(ON DELETE CASCADE & ON DELETE SET
NULL) between above table, and answer the following queries.
When we delete civil department from Department Table then what will be the
effect on both tables.
Experiment No. 21: Consider the following table:
Write a query to Perform Equi Join between two tables.
Experiment No. 22:
Consider the following tables CABHUB and CUSTOMER.
Write SQL commands for the following:
(a) To display the names of all the white coloured vehicles.
(b) To display name of vehicle name and capacity of vehicles in ascending order
of their seating capacity.
(c) To display the highest charges at which a vehicle can be hired from CABHUB.
(d) To display the customer name and the corresponding name of the vehicle
hired by them.
Experiment No. 23:
Consider the following table GAME.
Write SQL Commands for the following statements:
(a) To display details of those GAMES which are having Prizemoney more than
7000.
(b) To display the content of the GAMES table in ascending order of Schedule
Date.
( c) To display the sum of Prizemoney for each type of GAMES.
Experiment No. 24:
Write the UPDATE command to increase the commission (Column name : COMM)
by 500 of all the Salesmen who have achieved Sales (Column name : SALES) more
than 200000. The table's name is COMPANY.
Experiment No. 25:
Based on the SQL table CAR_SALES, write suitable queries for the following :
(i) Display fuel wise average sales in the first quarter.
(ii) Display segment wise highest sales in the second quarter.
(iii) Display the records in the descending order of sales in the second quarter.
Experiment No. 26:
In a Database, there are two tables given below :
Write SQL Queries for the following :
a. To display employee ids, names of employees, job ids with corresponding job
titles.
b. To display names of employees, sales and corresponding job titles who have
achieved sales more than 1300000.
[Link] display names and corresponding job titles of those employees who have
'SINGH' (anywhere) in their names.
[Link] foreign key in the table EMPLOYEE.
[Link] SQL command to change the JOBID to 104 of the EMPLOYEE with ID as E4
in the table 'EMPLOYEE'.
Experiment No. 27:
In a Database Tamilnadu_Sangam there are two tables with the instances given
below :
Write SQL queries for the following :
(i) To count how many addresses are not having NULL values in the address
column of STUDENTS table.
(ii) To display Name, Class from STUDENTS table and the corresponding Grade
from SPORTS table.
(iii) To display Name of the student and their corresponding Coachnames from
STUDENTS and SPORTS tables.
Experiment No. 28:
Find the min, max, sum, and average of the marks in a student marks table.
Experiment No. 29:
Find the total number of customers from each country in the table (customer ID,
customer Name, country) using group by.
Experiment No. 30:
Write a SQL query to order the (student ID, marks) table in descending order of
the marks.
Experiment No. 31:
Consider the following table named “DRINK”.
DRINKCODE DNAME PRICE CALORIES
101 Lime and Lemon 20 120
102 Apple Drink 18 120
103 Nature Nectar 15 115
104 Green Mango 15 140
105 Aam Panna 20 135
106 Mango Juice Bahaar 12 150
Write commands of SQL for
To display names and drink codes of those drinks that have more than 120
calories.
Experiment No. 32:
Project 1:
# Importing and exporting data between pandas and CSV file.
# To create and open a data frame using ‘Student_result.csv’ file using Pandas.
# To display row labels, column labels data types of each column and the
dimensions
# To display the shape (number of rows and columns) of the CSV file.
# To display Adm_No, Gender and Percentage from ‘student_result.csv’ file.
# To display the first 5 and last 5 records from ‘student_result.csv’ file.
# To display Student_result file with new column names.
# To modify the Percentage of student below 40 with NaN value in dataframe.
Project 2:
Data Visualization of Covid 2020-2021 analysis with csv file.
Project 3:
Titanic Data Analysis.