You are on page 1of 28

1. Create a series from an ndarray and a dictionary of values.

SOURCE CODE

2. Create a series to display percentage obtained by each student. (The mark is


out of 25) Index should be roll no.
SOURCE CODE
3. Create a series to store the amount of sales made by a salesperson for the
last year (whole months).
a) Display the sales amount which is greater than 10000.
b) Display the sales amount in the first four months.
c) Display the sales amount in the last four months .
SOURCE CODE
4. Create a series to store the marks in IP of 5 students in a class. The
ROLLNO should be the index. Read the rno of the student and make
changes in his/her marks. Display the marks of all students after making
changes. A teacher thought, it will be easy to track students if the names
is used as index instead of rollno. Write a program for the above case and
display the marks of students with the new index.
SOURCE CODE
5. Write a program to accept the name and mark obtained by 3 students for 2
terms (using series) . Find the total mark and percentage of each student.
SOURCE CODE
6 . Consider a Series object that stores the charity contribution (in Rs) of
each section of a school as shown below:
XI A 6000
Write code to: XI B 7800
a. Modify the amount of section ‘XI A’ as 7600 and for sections XI C 6540
‘XI C’ and ‘XI D’ as 7000 and print the Series. XI D 7890
b. Display the first 3 elements (use slicing)
XI E 6890
c. Display the last 3 elements.(use slicing)
XI F 7000
d. Display Third and Fourth elements(using iloc)
e. Display Second, Third and Fourth elements(using loc).
SOURCE CODE
7. Create a Series object. Display data type, shape of data, item size,
dimension, index, number of bytes, values, number of elements , any nan
values and empty or not based on the above series.
SOURCE CODE
8. Consider 3 series :
s1=[11,12,13,14] , index =[1,2,3,4] s2=[21,22,23,24] ,
index=[1,2,3,4] s3=[21,22,23,24],
index=[101,102,103,104] Perform all mathematical
operations on them.

SOURCE CODE
9.Create a data frame using a dictionary with the given data: '2015':
[256,452,635,965], '2016':[745,785,478,547],
'2017':[452,474,725,854], '2018':[1021,958,528,425]
index=['Qtr1','Qtr2','Qtr3','Qtr4']
Find the following:

i) Display the dataframe


ii) Sales of 2017
iii) Sales in quarter2
iv) Sales in 2015, 2016 and 2017 for quarter 1 &2
v) Indices of dataframe and columns of dataframe
vi) Row and column labels
vii) Number of rows and columns
viii) Sales in qtr 4 during the yeara 2018
ix) Change sales in qtr3 during 2017 to 754 and print
x) Add a new column 2019 with values[524,639,785,458]for all quarters
OUTPUT
10.Create a dataframe to enter names of 6 students and their marks (In which
one data is repeated).

i) Display the duplicated data. ii) Find the top 3 marks .


11. Create a data frame with dictionary with keys as 'DATA1' and 'DATA2. Their
values are [12,-55,67,78,nan,-44] and [56,-78,89,-90,nan,87] respectively.

i) Replace all negative values with zero and all nan with 999.
ii) Display the resultant dataframe.
iii) Remove the first row and display the new dataframe.
12.Create a dataFrame using student name , roll number and grade as the
keys.Trasfer this dataframe to CSV file using tab as separator. Later load the
above csv file and display the data.
13. Create a data frame with series 1 as author and series 2 as article. Then add a
new column age to the data frame . Plot a bar graph showing age and article.

OUTPUT
14. Create a csv file with id ,fname, marks in English, accountancy and IP. Read
csv using dataframe and do the following

i) Create a bar chart plotting total and performance of English


ii) Create a histogram plotting number of students vs their marks in English,
accountancy and IP.
iii) Create a line chart indicate the performance of ip
OUTPUT
15. Create a csv file with id,fname marks in English, accountancy and IP. Read csv
using dataframe and do the following

i) Display the details of topper


ii) Display English toppers details
iii) Create a bar chart compare the performance of each subject.
16. Create a dataframe using dictionary, to show the unemployment rate from
1920 to 2010 using line chart.
Year = [1920,1930,1940,1950,1960,1970,1980,1990,2000,2010]
Unemployment_Rate = [9.8, 12, 8, 7.2, 6.9, 7, 6.5, 6.2, 5.5, 6.3]
Specifications: Chart color-red, marker-circle, font size-14

OUTPUT
17. Create a dataframe using a dictionary with given data
'Name':pd.Series(['Tom','James','Ricky','Vin',]),
'Age':pd.Series([25,26,25,23]), 'Rating':pd.Series([4.23,3.24,3.98,2.56] and
perform the following: i) Print the number of values in column age ii) Print
number of values in each column and each row iii) Iterate over rows and
columns

OUTPUT
18. Write a program to draw line charts for the following: a. Show
the population of india vs Pakistan from 1960 – 2010
Ind=[449.48, 553.57, 696.783, 870.133,1000.4, 1309.1]
pak=[44.91, 58.06, 78.07, 107.7, 138.5, 170.6]
b. Show the unemployment rate from 1920 to 2010
Year = [1920,1930,1940,1950,1960,1970,1980,1990,2000,2010]
Unemployment_Rate = [9.8, 12, 8, 7.2, 6.9, 7, 6.5, 6.2, 5.5, 6.3]
SOURCE CODE
19. Program to plot line chart to solve the following algebraic expressions
i) 10X+14 ii) Y2=4X

SOURCE CODE
20. Create bar chart to show the following:
i). Represent the performance of programming languages:
python","c++","Java","Perl","Scala","lisp" given by different users as
10,8,6,4,2,1 respectively using horizontal barchart
ii) Represent class as [ "V","VI","VII","VIII","IX","X”] and strength =[49,38,50,37,43,39] using a normal bar
chart
SOURCE CODE
21. Input the name and mark of 4 students in two lists. Represent their performance using a bar chart.
SOURCE CODE
22. Create a csv using the data about cars (name, price in lakhs and mileage) as given below:
'car':['BMW','Honda','Toyota', 'Hyundai'], 'price':[ 100,8,45,7],
'mileage':[39,27,26,26]}
Read the above csv and plot a bar chart represents car and its price.
SOURCE CODE

OUTPUT
23. Create an array having 30 elements between 5 and 50. Plot the following having 10 bins. i)
Simple histogram ii) Horizontal histogram iii) Step-Type histogram iv) Cumulative histogram

SOURCE CODE

OUTPUT

You might also like