Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
610 views16 pages

Ip Practical File

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)
610 views16 pages

Ip Practical File

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/ 16

QUESTION No.

➼ Write a program to create a Series object Se1 using a


dictionary that stores the number of students in each section of
class 12 of your school.

CODE:

OUTPUT:
QUESTION No. 2
➼Write and Display the answers of both the Boolean indexing
statements: print (Se1>45), print (Se1[Se1>40]).
CODE:

OUTPUT:
QUESTION No. 3
➼ To generate a series Se2 of 6 numbers with scalar value 56
having index values [a,b,c,d,e,f].

CODE:

OUTPUT:
QUESTION No. 4
➼Use and display the working of all attributes of Series Se2 (of
question no 3) and print the top 3 elements using the head
function and last 4 elements using the tail function. (In
interactive mode)
CODE AND OUTPUT:
QUESTION No. 5
➼ Create two series S1 having values [2,3,4,5] , index [a,b,c,d]
and S2 values [6,7,8,9],index [a,x,c,z] respectively. Perform
mathematical operations using operators [S1+S2 , S2-S1 , S1*S2
,S2/S1] and methods [add(),sub(),mul(),div()].
CODE:

OUTPUT:
QUESTION No. 6
➼To create a Data Frame from List of Dictionaries having at
least 6 rows and 4 columns.[Take your six friend’s marks in four
subjects(column) ,friend name row index]

CODE:

OUTPUT:
QUESTION No. 7
➼To create a Data Frame df from Dictionary of Series having at
least 6 rows (six cities’ name) and 4 columns (temperature on
Mon, Tue, Wed, Thu days of first week of June.[ following is a
dummy sample dataframe you can take cities name according
to your choice and change temperature of city accordingly]

CODE:

OUTPUT:
QUESTION No. 8
➼ To add a new Column ‘Sun’ with proper data to Data Frame
df.

CODE:

OUTPUT:
QUESTION No. 9
➼. Display the total temperature of all cities as column name
‘T_temp’ by adding temperature of all five days.
CODE:

OUTPUT:
QUESTION No. 10
➼. To add a new Row having ‘Dehradun’ index with data to Data
Frame df.
CODE:

OUTPUT:
QUESTION No. 11
➼To delete a range of rows 2 to 4 from Data Frame df.

CODE:

OUTPUT:
QUESTION No. 12
➼To delete a range of columns 1 to 3 from Data Frame df.

CODE:

OUTPUT:
QUESTION No. 13
➼To delete any 2 random Rows from a Data Frame df.

CODE:

OUTPUT:
QUESTION No. 14
➼To delete any 2 random Columns from a Data Frame df.

CODE:

OUTPUT:
QUESTION No. 15
➼To rename the top two Row Labels as ‘City-1’,’City-2’and
third and fourth Column Labels as ‘Day-3’,’Day-4’ of Data Frame
df.

CODE:

OUTPUT:
QUESTION No. 16

➼Use and display the working of all attributes of Data Frames


on the pandas objects that you have created in question-6.(In
interactive mode).

CODE AND OUTPUT:

You might also like