0% found this document useful (0 votes)
15 views4 pages

SET C (Practical)

The document provides a practical guide for using Python with pandas and matplotlib to create and visualize a DataFrame of student data and unemployment rates over the years. It also includes SQL syntax for creating and manipulating tables for stationary and consumer data, with various queries to display and update information. Key SQL operations include creating tables, inserting values, selecting data based on conditions, and updating prices.

Uploaded by

cehsp10330
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

SET C (Practical)

The document provides a practical guide for using Python with pandas and matplotlib to create and visualize a DataFrame of student data and unemployment rates over the years. It also includes SQL syntax for creating and manipulating tables for stationary and consumer data, with various queries to display and update information. Key SQL operations include creating tables, inserting values, selecting data based on conditions, and updating prices.

Uploaded by

cehsp10330
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

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;

(vi) Select Address, count(Address) from Consumer group by Address;

(vii) Select * from Consumer where S_ID = “PL01”;

You might also like