SET C (Practical)
SET C (Practical)
PYTHON
1) import pandas as pd
data={'student
name':['avni','bushra','aqsa','angel'],'accounts':[79,76,78,75],'eco':[80,78,77,76],'bst':[76,75,74,77
]}
df=pd.DataFrame(data)
print(df)
i) row labels
print(df.index)
ii) column labels
print(df.columns)
iii) data type
print(df.dtypes)
iv) dimensions
print(df.ndim)
2)
import matplotlib.pyplot as plt
x=[1940,1950,1960,1970,1980,1990,2000,2010,2020,2023]
y=[80,75,60,60,70,50,60,40,75,75]
plt.plot(x,y,color='red',marker='o')
plt.title('unemployment rate(1940-20230)',fontsize=10)
plt.xlabel('year',fontsize=10)
plt.ylabel('unemployment rate(%)',fontsize=10)
plt.legend(fontsize=10)
plt.grid(True)
plt.show()
SQL - SYNTAX
● STATIONARY
CREATE- create table stationary(s_id varchar(5),stationaryname char(20),company
char(3),price int(2));
INSERT- insert into stationary values('PL02','pencil','XYZ',6);
● CONSUMER
CREATE-create table consumer(C_ID int(2),consumername char(20),address char(20),s_id
varchar(5));
INSERT- insert into consumer values(01,'Good Learner','Delhi','PL01');
(i) To display the details of those consumers whose Address is Delhi.
- select * from consumer where address='Delhi';
(ii) To display the details of Stationary whose Price is in the range of 8 to 15. (Both Value
included)
- select * from stationary where price between 8 and 15;
(iii) To display the ConsumerName, Address from Table Consumer, and Company and Price
from
table Stationary, with their corresponding matching S_ID.
- select consumer.consumername,consumer.address,stationary.company,stationary.price from
stationary,consumer where consumer.s_id=stationary.s_id;
(iv) To increase the Price of all stationary by 2.
-update stationary set price=(price+2);
(v) Select * from Consumer order by Address;