Professional Documents
Culture Documents
PRACTICAL FILE
INFORMATICS PRACTICES
INPUT OUTPUT
QUESTION 2:
Write a program to multiply and divide two Pandas Series.
INPUT OUTPUT
QUESTION 3:
Write a program to multiply and divide two Pandas Series.
INPUT OUTPUT
QUESTION 4:
Write a program to create a Series named S1 and display its type. Change the
Series into a list and display its type. Also display the elements of the Series which
are above 20.
INPUT OUTPUT
QUESTION 5:
Write a program to change the order of index of a given series.
Original Data Series:
INPUT OUTPUT
QUESTION 6:
Write a program to create and display a DataFrame from a specified dictionary
with index labels.
.
INPUT OUTPUT
QUESTION 7:
Write a program to get the first 3 rows and last 4 rows of a given DataFrame
INPUT OUTPUT
QUESTION 8:
Create a dataframe for examination result and display row labels, column labels,
data types of each column and the dimensions
INPUT OUTPUT
QUESTION 9:
Write a program to create a Dataframe quarterly sales where each row contains
the item category, item name, and expenditure.
Do the following tasks in the dataframe:
a) Display the itemname and expenditure columns
b) Display the rows where expenditure is more than 2500
INPUT OUTPUT
QUESTION 10:
Write a program to create a dataframe ‘data’ with the following details:
a) Display city and favourite_color columns of first, fourth and seventh rows
b) Access value Chennai
c) Find rows where value of age is more than 16
d) Find rows where age is more than 13 and gender is Female
INPUT OUTPUT
QUESTION 11:
Write a Pandas program to count the number of rows and columns of a
DataFrame.
INPUT OUTPUT
QUESTION 12:
Write a program to:
a) import data from CSV to Pandas
b) export data from Pandas to a CSV file
INPUT OUTPUT
QUESTION 13:
Write a Program to create a dataframe emp to hold empno, empname and salary
details of 5 employees and perform the following tasks:
(a) Add a column ‘Bonus’ which is calculated as 5% of salary.
(b) Add a column ‘Dept’ between empname and salary columns and
populate it
with appropriate values.
(c) Remove the column ‘Bonus’.
INPUT OUTPUT
QUESTION 14:
Write a program to create dataframe ‘stock’ with the following data:
INPUT OUTPUT
QUESTION 15:
Write a program to select the 'name' and 'score' columns from the following
DataFrame. Also change the score in row ‘d’ to 11.5.
INPUT OUTPUT
QUESTION 16:
A DataFrame 'item' has the following columns : pid,pname, price.
OUTPUT
INPUT
DATA
VISUALISATION
QUESTION 17:
Write a program to create a dataframe to store the school result data, analyses the
performance of the students on different parameters, e.g., subject wise or class
wise.
INPUT OUTPUT
QUESTION 18:
Given a dataframe df1 as shown below:
INPUT OUTPUT
QUESTION 19:
Create a Dataframe quarterly_sales with columns Salesman, Sales, Quarter and
District.
Write a program to draw a histogram based on monthly sales report for all
numeric columns
INPUT OUTPUT
QUESTION 20:
Consider the data given below:
INPUT OUTPUT
QUESTION 21:
a) Create a database school. Inside this database, create a table student with
the appropriate specifications for storing the following data.
SHOW DATABASES;
CREATE TABLE STUDENT (No INT, Name VARCHAR(25), Stipend DECIMAL, Stream
VARCHAR(30), AvgMark DECIMAL, Grade VARCHAR(5), Class VARCHAR(10), PRIMARY
KEY(No));
c) Delete the details of ‘Mohan’. Undo the changes. Save the details
permanently.
delete from student where Name = 'Mohan';
e) List the names of those students who are in class 12 sorted by stipend
h) Display the details of students who scored Avgmarks less than 75 and Grade
is B
i) Display the details of students who scored Avgmarks less than 75 and
Grade is B
j) List the name and stream of students whose name contains letter ‘a’
l) Display No, Name and Class of students whose score is in the range 60 to 80
SELECT No, Name, Class FROM student WHERE AvgMark BETWEEN 60 AND 80;
USE school;
-> VALUES(1, 'Tanya Nanda', 'Social Studies', '1994-03-17', 'TGT', 'F', 25000);
e) To list names, departments and date of hiring of all teachers in ascending order of date of
hiring
SELECT Name, Department, Hiredate FROM Teacher
l) Add a new column Bonus to the table and Compute the Bonus as 10% of
Salary
ALTER TABLE Teacher
m) Add a new column Bonus to the table and Compute the Bonus as 10% of
Salary
SELECT Name, Department
-> FROM Teacher
#-> WHERE Name NOT LIKE '%r%';
n) A Display the details of teachers in ascending order of Category, then descending
order of Salary
SELECT * FROM Teacher ORDER BY Category ASC;