XII_IP
XII_IP
0 2010 Jan 25
1 2010 Mar 50
2 2012 Jan 35
3 2010 Dec 55
4 2012 Dec 65
Help him to write the Python code to create the above Dataframe.
import pandas as pd
list1=[-10,-20,-30]
ser = pd.Series(list1*2)
print(ser)
Or
30. Based on the SQL table CAR_SALES, write suitable queries for the following:
+ + + + + +
| NUMBER | SEGMENT | FUEL | QT1 | QT2 |
+ + + + + +
| 1 | Compact HatchBack | Petrol | 56000 | 70000 |
| 2 | Compact HatchBack | Diesel | 34000 | 40000 |
| 3 | MUV | Petrol | 33000 | 35000 |
| 4 | MUV | Diesel | 14000 | 15000 |
| 5 | SUV | Petrol | 27000 | 54000 |
| 6 | SUV | Diesel | 18000 | 30000 |
| 7 | Sedan | Petrol | 8000 | 10000 |
| 8 | Sedan | Diesel | 1000 | 5000 |
+ + + + + +
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.
Or
Differentiate between COUNT () and COUNT (DISTINCT) functions. Explain with the help of example.
Section – D
31. Preeti manages database in a blockchain start-up. For business purposes, she created a table
named BLOCKCHAIN. Assist her by writing the following queries:
TABLE: BLOCKCHAIN
32. Naman has created the following DataFrame “Climate” to record the data about climatic conditions of
four years:
Year MaxTemp MinTemp Rainfall
2017 32 20 123
2018 33 22 140
2019 35 21 135
2020 34 23 160
(a) What will be the output of the following?
(i) Climate.iloc[1:3, 1:2]
(ii) print (Cimate.head(2))
(b) Write the Python code to display the temperature difference between MaxTemp and MinTemp for all
the rows in the DataFrame Climate.
(c) List 1st, 2nd and 3rd rows.
Or (Option for part (c) only)
The exact number of values in each column of the DataFrame?
Section – E
33. Write the output of following queries.
(i) SELECT POWER(9, 3);
(ii) SELECT MID(‘SHUCHI GOYAL’, 8, 5):
(iii) SELECT RIGHT(‘ Dushyant ’, 5);
(iv) SELECT INSTR(‘SQL FUNCTIONS’, ‘C’);
(v) SELECT LEFT(‘Arihant’,2);
34. WAP to take the marks of six subjects and display the total, percentage and also the display the
Grade according to the following condition.
Percentage Grade
>=90 A
<90 and >=75 B
<75 and >=50 C
<50 D
35. Write a program in python to check that given number is Armstrong number or not.
Note: 153=13+53+33 It is an arm strong number.