0% found this document useful (0 votes)
4 views

S7 IP Holidays Assignment

The document contains a series of programming assignments focused on Python and Pandas, requiring corrections to code snippets, completion of code, and explanations of concepts. Tasks include creating DataFrames, plotting charts, and understanding aggregate functions and SQL commands. The assignments aim to enhance the understanding of data manipulation and visualization using Python.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

S7 IP Holidays Assignment

The document contains a series of programming assignments focused on Python and Pandas, requiring corrections to code snippets, completion of code, and explanations of concepts. Tasks include creating DataFrames, plotting charts, and understanding aggregate functions and SQL commands. The assignments aim to enhance the understanding of data manipulation and visualization using Python.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Holidays Assignment

Make Program File


1. The python code written below has syntactical errors. Rewrite the correct code
and underline the corrections made.
Import pandas as pd
df={"Technology":["Programming","Robotics","3DPrinting"],"Time(in
months)":[4,4,3]}
df= Pd.dataframe(df)
Print(df)

2. Complete the given Python code to get the required output as: Rajasthan
import as pd
di = {'Corbett': 'Uttarakhand', 'Sariska': 'Rajasthan', 'Kanha': 'Madhya
Pradesh’,'Gir':'Gujarat'}
NP = . Series( )
print(NP[ ])

3. Fill the missing statements to get the given output:


import pandas as pd
rollno=[1,2,3,4,5,6,7]
=pd.Series(rollno) #Statement 1
print (p.head( )) #Statement 2

4. Consider two objects L and S. L is a list whereas S is a Series. Both have values 20, 40,90, 110. What
will be the output of the following two statements considering that the above objects have been
created already.
print (L+2) #Statement 1
print (S+2) #Statement 2
5. Mr. Harry wants to draw a line chart using a list of elements named LIST. Complete the code to perform
the following operations:
a. To plot a line chart using the given LIST
b. To give a y-axis label to the line chart named "sample number".
import matplotlib.pyplot as PLINE
LIST=[10,20,30,40,50,60]
#Statement 1
#Statement 2
6. A dictionary ‘stationary’ contains the following: 3
stationary={‘Name’:[ ‘books’, ‘copies’, ‘pencil
box’, ‘Pen’],
‘Price’:[ 500,350, 400,250]
7. Write statements for the following:
a. Create a Dataframe named “stock”
b. Add a column called ‘discount’ with the following data: [ 15, 20, 30, 25]
c. Delete column discount with all values.
8. Differentiate between Single Row and Multi Row Functions?
9. Write a program to create the series that stores the term marks of 10 students.
Find the highest and lowest three marks scored by students.

10. Write a program to create a series from list marks and taking index values from list roll no. Show all
elements that are above 80 marks.
11. What is the difference between the following two statements, which are creating two
dataframes using the same dataframe (Pandas library has been imported as pd)?
i. Df2=pd.DataFrame(df1)
ii. Df3=pd.DataFrame(df1, copy=True)
12. Given dataFrame namely aid that stores the aid by NGOs for different states:

Toys Books Uniform Shoes


Andhra 7916 6189 610 8810
Odisha 8508 8208 508 6798
M.P 7226 6149 611 9611
U.P 7617 6157 457 6457
Write statements to display the aid for

i. Book and Uniform only


ii. Shoes only
Assume that Pandas library has been imported as pd and the dataframe aid is already created.

13. What are aggregate functions? How are they useful?


14. What is the use of GROUP BY clause> Give example.

15. WAP to plot a line chart between two given arrays


A=[4,56,78,23,45,67,89]
B=[0,1,2,3,4,5,6]

16. Write Python code to create the following DataFrame df1 using Python Pandas. Use anymethod of
DataFrame creation that you have learned:
Name Class Marks
Arjun XII 95
Ruchi X 84
Prerna XI 90
Himali XI 75

17. Consider a given Series , D1:


MAX MARKS
TEST 1 30
TEST 2 40
TEST 3 50
TEST 4 100
Write a program in Python Pandas to create the series.
18. Consider the decimal number x with value 54567.8577. Write commands in SQL to:
i. display the whole number without round it off.
ii. round it to 2 places of the decimal.

19. A company randomly generated a weekly winning number (between 0. 1000) for 10 weeks. An employee of the
company wants to plot the sine values of winningnumbers (nump.sin( ) function) on a line chart. Write a
program to help him accomplish this.

20. Write a small python code to create a dataframe with headings (a and b) from the list given
below: [ [1,2],[3,4],[5,6],[7,8] ]
Page 5 of 7
Page 6 of 7
Page 7 of 7
Page 8 of 7

You might also like