Anki Tabish T
Anki Tabish T
1. SERIES
2. DATA FRAME
3. DATA VISUALISATION
4. MY SQL
5. SINGLE TABLES
6. DOUBLE TABLES
Q1 Create a Series from a List
CODING:
OUTPUT:
Q2 Create a Series with Custom Index
CODING:
OUTPUT:
Q3 Arithmetic Operations on Series
CODING:
OUTPUT:
Q4 Accessing Elements in a Series
CODING:
OUTPUT:
Q5 Filtering a Series
CODING:
OUTPUT:
Q6 Series from a Dictionary
CODING:
OUTPUT:
Q7 Series Operations: Mean, Min, Max
CODING:
OUTPUT :
Q1 Create a DataFrame from a Dictionary
CODING:
OUTPUT:
Q2 Add a new column to DataFrame
CODING:
OUTPUT:
Q3 Delete a Column from Data Frame
CODING:
OUTPUT:
Q4 Select Rows based on Conditon
CODING:
OUTPUT:
Q5 Access Specific Row/Column using
loc and iloc
CODING:
OUTPUT:
Q6 Sort DataFrame by Column
CODING :
OUTPUT:
Q7 GroupBy and Aggregation
CODING :
OUTPUT :
Q8 DataFrame from List of Dictionaries
CODING :
OUTPUT:
Q9 Merge Two DataFrames
CODING:
OUTPUT:
Q10 Write a program that simulates weather
data and performs basic analysis on it, like
calcula�ng average temperature and total
rainfall.
CODING:
OUTPUT:
Q11. Creates a sales dataframe, and calculates
total sales and average sales per product.
CODING:
OUTPUT:
Q12. Analyzes a dataframe of COVID-19 cases in
different ci�es.
CODING:
OUTPUT:
Q13. Write a program to handles book data in
a library, analyzing the availability and
categoriza�on of books.
CODING:
OUTPUT:
Q14.Creates a dataframe of cricket players'
performances and calculates the total runs and
average strike rate.
CODING:
OUTPUT:
Q1 Line Plot
CODING :
OUTPUT :
Q2 Bar plot
CODING:
OUTPUT:
Q3 Histogram
CODING :
OUTPUT:
Q4 Pie chart
CODING:
OUTPUT:
Q5 Scatter Plot
CODING:
OUTPUT:
Q6 Box plot
CODING:
OUTPUT:
Q7 Multiple line plot
CODING:
OUTPUT:
Q8 . Stacked bar plot
CODING:
OUTPUT :
MY SQL
PROGRAMS
SINGLE TABLE
Q1.How to create database and use a
database.
Q2. Consider the table SPORTS given below. Write
commands in SQL for (i) to (iv) and output for (v) to (viii).
TABLE:Sports
(i) Display the names of the students who have grade 'A'
in either Game1 or Game2 or
both.
Ans: Select Name from SPORTS where Grade1-'A' OR
Grade2='A';
(ii) Display the number of students having game 'Cricket'.
Ans:Select count(*) from SPORTS Where Game1='Cricket'
OR Game2 'Cricket';
iii) Display the names of students who have same game
for both Gamel and Game2.
Ans:Select Name from SPORTS where Game1-Game2;
(iv) Display the games taken by the students whose name
starts with 'A'.
Ans: Select Game1, Game2 from SPORTS where Name
LIKE 'A%';
(v) SELECT COUNT(*) FROM SPORTS.
Ans: 6
(vi) SELECT DISTINCT Class FROM SPORTS.
Ans :7
9
10
(vii) SELECT MAX(Class) FROM STUDENT;
Ans: 10
(vii) SELECT COUNT(*) FROM SPORTS GROUP BY Game1;
Ans: 2
2
1
1
Q3.Consider the following tables HOSPITAL. Give outputs
for SQL queries (i) to (iv) and write SQL commands for
the statements (v) to (viii)
TABLE-Hospital
2.Insert record
3.selec�ng all teachers
TABLE:RECIPIENT
TABLE:CUSTOMER
(i) To display the details of those Customers
whose city is Delhi.
Ans: Select all from Customer Where
City="Delhi"
(ii) To display the details of Item whose Price is
in the range of 35000 to 55000 (Both values
included).
Ans: Select all from Item Where Price>=35000
and Price <=55000
(iii) To display the CustomerName, City from
table Customer, and ItemName and Price from
table Item, with their corresponding matching
I_ID.
Ans: Select CustomerName, City, ItemName,
Price from Item, Customer where
Item.I_ID=Customer.I_ID.
(iv) To increase the Price of all Items by 1000 in
the table Item.
Ans: Update Item set Price-Price+1000
(v) SELECT DISTINCT City FROM Customer.
Ans: City
Delhi
Mumbai
Bangalore
(vi) SELECT ItemName, MAX(Price), Count(*)
FROM Item GROUP BY ItemName;
Ans:
ItemName Max(Price) Count(*)
Personal Computer 37000 3
Laptop 57000 2
(vii) SELECT CustomerName, Manufacturer
FROM Item, Customer WHERE
Item.Item_Id=Customer.Item_Id;
Ans:
TABLE:FARES
(i) Display FL_NO and NO_FLIGHTS from "KANPUR"
TO "BANGALORE" from the table FLIGHTS.
Ans: Select FL_NO, NO_FLIGHTS from FLIGHTS
where Star�ng-"KANPUR" AND ENDING
"BANGALORE"
(ii) Display the FL_NO and fare to be paid for the
flights from DELHI to MUMBAI using the tables
FLIGHTS and FARES, where the fare to paid
FARE+FARE+TAX%/100.
Ans: Select FL_NO, FARE+FARE+(TAX%/100) from
FLIGHTS, FARES where Star�ng-"DELHI" AND
Ending-"MUMBAI"
(iii) Display the minimum fare "Indian Airlines" is
offering from the tables FARES.
Ans: Select min(FARE) from FARES Where AIRLINES-
"Indian Airlines";
(iv) Select FL_NO,NO_FLIGHTS, AIRLINES from
FLIGHTS, FARES Where STARTING = "DELHI" AND
FLIGHTS.FL_NO = FARES.FL_NO
Ans: FL_NO NO_FLIGHTS AIRLINES IC799 2 Indian
Airlines
Q4.Consider the following tables Product and
Client. Write SQL commands for the statement (i)
to (iv) and give outputs for SQL queries (v) to (viii)
Table: PRODUCT
TABLE: CLIENT
(i) To display the details of those Clients whose
city is Delhi.
Ans: Select all from Client where City="Delhi"
(ii) To display the details of Products whose Price
is in the range of 50 to 100 (Both values
included).
Ans: Select all from product where Price between
50 and 100
(iii) To display the ClientName, City from table
Client, and ProductName and Price from table
Product, with their corresponding matching P_ID.
Ans: Select ClientName, City, ProductName, Price
from Product, Client where
Product.P_ID=Client.P_ID.
(iv) To increase the Price of all Products by 10
Ans: Update Product Set Price Price +10
(v) SELECT DISTINCT Address FROM Client.
Ans: (The above ques�on may consist DISTINCT
City. If it is DISTINCT City, the following is the
answer)
City
----------
Delhi
Mumbai
Bangalore
vi) SELECT Manufacturer, MAX(Price), Min(Price),
Count(*) FROM Product GROUP BY Manufacturer;
Ans:
Manufacturer Max(price) Min(price)
Count(*)
LAK 40 40 1
ABC 55 45 2
XYZ 120 95 2
(vii) SELECT ClientName, ManufacturerName
FROM Product, Client WHERE
Client.Prod_Id=Product.P_Id;
Ans:
ClientName ManufacturerName
Cosme�c Shop ABC
Total Health ABC
Live Life XYZ
Prety Woman XYZ
Dreams LAK
(viii) SELECT ProductName, Price * 4 FROM
Product.
Ans. ProductName Price*4
Talcom Poweder 160
Face Wash 180
Bath Soap 220
Shampoo 480
Face Wash 380