0% found this document useful (0 votes)
26 views17 pages

Ip Record

The document provides instructions for various tasks involving pandas and SQL. It includes creating pandas Series and DataFrames, importing and exporting CSV files, filtering and aggregating data, joining tables, and more. The tasks cover basic to intermediate pandas and SQL operations for working with and analyzing data.
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)
26 views17 pages

Ip Record

The document provides instructions for various tasks involving pandas and SQL. It includes creating pandas Series and DataFrames, importing and exporting CSV files, filtering and aggregating data, joining tables, and more. The tasks cover basic to intermediate pandas and SQL operations for working with and analyzing data.
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/ 17

PracticalFile-InformaticsPractices(ClassXII)

1.Createapandasseriesfromadictionaryofvaluesandanndarray.

2.Create a series object ‘vowels’ to store all vowels individually its index should be 1,2,3,4,5

import pandas as pd
vowels=pd.Series(([‘a’,’e’,’i’,’o’,’u’], index=[1,2,3,4,5])
print(vowels)

3.Create a series object ‘s’ using nparray that has 5 elements between 50 and 100
1|Page
4. Create a series object ‘item’ that stores rate of each product as given below
soap=54 salt=20 sugar=39
Write a code to modify rate of soap 44 and sugar to 42,print the changed rate.

5.No.of students in class 11,12 streams (Science,commerce,Humanities) are stored in to series


object class 11&class 12. Write a code to find total no.of the students in class 11 & 12

import pandas as pd
d1={'science':32,'commerce':30,'humanities':20}
d2={'science':28,'commerce':34,'humanities':22}
class11=pd.Series(d1)
class12=pd.Series(d2)
print(class11)
print(class12)
print('Total Students')
print(class11+class12)

2|Page
6.Create a series object ‘population’ to store population of 5 different metro cities and display
the population that are more than 3 lakhs

import pandas as pd
population=pd.Series([400000,25400,30110,100500,500500],['Mumbai','Kolkata','Delhi','Chennai','Hydrabad'])
print(population)
print('Population more than 300000')
print(population[population>300000])

7.Given aSeries,printalltheelementsthatareabovethe75thpercentile.

3|Page
8 . CreateaDataFramequarterlysaleswhereeachrowcontainstheitemcategory,itemname,and
expenditure.Grouptherowsbythecategory,andPrint the total expenditure per category .

4|Page
9.Createadataframeforexaminationresultanddisplayrowlabels,columnlabelsdata
types ofeachcolumn andthedimensions

10.Filteroutrowsbasedondifferentcriteriasuchasduplicaterows.

5|Page
11.Locatethe3largestvaluesin adataframe.

12.Replaceall negativevalues inadataframe witha0.

6|Page
13.Replaceallmissingvaluesinadataframewitha999.

14.ImportingdatafromCSVfile to Pandas

15.ExportingdatafromPandastoCSVfile

7|Page
16.Giventheschoolresultdata,analysetheperformanceofthestudentsondifferentparamete
rs,e.gsubject wiseorclass wise.

8|Page
17.FortheDataframescreatedabove,analyzeandplotappropriatechartswithtitlea
nd legend.

9|Page
18.Write a program to plot a line chart to depict the changing weekly onion price for four weeks give
appropriate Axes labels.

importmatplotlib.pyplot as plt
week=[1,2,3,4]
prices=[40,80,100,50]
plt.plot(week,prices)
plt.xlabel('week')
plt.ylabel('Onion Prices(Rs.)')
plt.show()

19.Smile NGO has participated in a three week cultural mela.usingpandas,they have stored the sales(in Rs) made dat wise
for every week in a CSV file named “MelaSales.CSV” as shown in Table.

Week1 Week2 Week3


5000 4000 4000
5900 3000 5800
6500 5000 3500
3500 5500 2500
4000 3000 3000
5300 4300 5300
7900 5900 6000

Depict the sales for the three weeks using a lone chart it should have the following.
I) Chart title as ‘Mela Sales Reprt’
II) X-axis label as ‘Days’
III) Y-axis label as “Sales in Rs”

10|Page
import pandas as pd
importmatplotlib.pyplot as plt
df=pd.read_csv("d:\melasales.csv")
df.plot(kind='line',color=['red','blue','brown'])
plt.title('Mela sales Report')
plt.xlabel('week')
plt.ylabel('Onion Prices(Rs.)')
plt.show()

#16.Takedataofyourinterestfromanopensource(e.g.data.gov.in),aggregateandsu
mmarizeit.ThenplotitusingdifferentplottingfunctionsoftheMatplotlib

11|Page
12|Page
13|Page
#17.Createastudenttablewiththestudentid,name,andmarksasattributeswherethe
studentidis the primarykey.

#18.Insertthedetailsofanewstudentintheabovetable.

#19.Deletethedetailsofaparticularstudentintheabovetable.

14|Page
#20.Use the select command to get the details of the students with
marksmorethan 80.
Select * from student where marks>80;

#21.Createanewtable(orderID,customerName,andorderDate)byjoiningtwotables
(orderID,customerID,andorderDate)and(customerID,customer

15|Page
#22.Createaforeignkeyinoneofthetwotablesmentionedabove

#23.Findthemin,max,sum,andaverageofthemarksinastudentmarkstable.

#24.Findthetotalnumberofcustomersfromeachcountryinthetable(customerID,cus
tomerName,country)usinggroup by.

16|Page
#25.Createanewtable(name,dateofbirth)byjoiningtwotables(studentid,name)an
d (studentid,dateofbirth).

#26.WriteaSQLquerytoorderthe(studentID,marks)tableindescendingorderofthe
marks.

17|Page

You might also like