SUBJECT – INFORMATICS PRACTICES
MM – 30 TIME – 3 HOURS
SET-1
Q.1
SNo |
SName |
Sale1 |
Sale2 |
101 |
George |
15 |
20 |
102 |
Sulivan |
17 |
18 |
103 |
Teresa |
14 |
19 |
104 |
Peter |
12 |
13 |
Write
a program in Python Pandas to create the following DataFrame salesman from a
Dictionary:
- Create and display the DataFrame
- Display the average score of Sale1 column.
- Show the sales of sulivan only.
Q.2
Consider
the following table named “GYM” with details about fitness items being sold in
the store. Write command of SQL for (i) to (iv).
Table : GYM
ICODE |
INAME |
PRICE |
BRADNAME |
G101 |
Power Fit Exerciser |
20000 |
Power Gymea |
G102 |
Aquafit Hand Grip |
1800 |
Reliable |
G103 |
Cycle Bike |
14000 |
Ecobike |
G104 |
ProtonerExexteme Gym |
30000 |
Coscore |
G105 |
Message Belt |
5000 |
Message Expert |
G106 |
Cross Trainer |
13000 |
GTC Fitness |
Questions:
- To display the name of all the items whose name starts with “A”.
- To display ICODes and INAMEs of all items, whose Brandname is Reliable or Coscore.
- To change the Brandname to “Fit Trend India” of the item, whose ICODE is “G101”.
- To add a new row for new item in GYM with the details:
“G107”, “Vibro exerciser”, 21000,
“GTCFitness”
SOLUTION
(I)
Import
pandas as pd
df
= {‘SNo’ : [102, 102, 103,104],
‘SName’:
[‘George’, ‘Sulivan’, ‘Teresa’, ‘Peter’],
‘Sale1’
:[ 15, 17, 14, 12],
‘Sale2’:
[20, 18, 19, 13]}
Salesman=pd.DataFrame(df)
(i)
print(salesman)
(ii)
salesman.Sale1.mean() or salesman[‘Sale1’].mean()
(iii)salesman[salesman[‘SName’]==’Sulivan’]
or
salesman[salesman[‘SName’]==’Sulivan’]
(II)
- SELECT INAME FROM GYM WHERE INAME LIKE “A%”;
- SELECT ICODE, INAME FROM GYM WHERE BRANDNAME = “RELIABLE” AND “COSCORE”;
- UPDATE GYM SET BRANDNAME = “FIT TREND INDIA” WHERE ICODE = “G101”;
- INSERT INTO GYM VALUES(“G107”, “VIBRO EXERCISER”, 21000, “GTCFITNESS”;
I will provide many sets of practical sample papers for class XII (IP)
Continue to visit the blog.
Thank You !!!
No comments:
Post a Comment
Please do not any spam in the comment box.