0(Ncert)
1. Create the following series and do the specified operations:
- Engalph, having 26 elements with the alphabets as values and default index values.
Input:-
Output:-
- Vowels having 5 elements with index lables , a,e,i,o,u and all the five values set 2 zero ,check
if it is an empty series.
INPUT:-
Output:-
- Friends, from a dictionary having roll no. of 5 of your friends as data and their first name as
keys.
INPUT:-
OUTPUT:-
- MTseries, an empty series. Check if it is an empty series.
Input:-
Output:-
- Monthdays, from a numpy array having the number days in the 12 months of a year. The
labels should be month numbers from 1 to 12.
Input:-
Output:-
2. Using the series created in question 1, write commands for the following:
- Set all the values of vowels to 10 and display the series.
Input:-
Output:-
- Divide all values of vowels by 2 and display the series.
Input:-
Output:-
- Create another series vowels1 having 5 elements with index labels A,E,I,O,U having values
2,5,6,3,8.
Input:-
Output:-
- Add vowels and vowels1 and assign the result to vowel 3.
Input:-
Output:-
- Subtract, multiply and divide vowels by vowels1.
Subtract:-
Input:
Output:
Multiply:-
Input:-
Output:-
Divide:-
Input:-
Output:-
- Alter the labels of vowels1 to [a,e,i,o,u].
Input:-
Output:-
3. using the series created in question 5, write the commands for the following:
a. find the dimensions, size and values of the series EngAlph, Vowels, Friends, MTseries,
MonthDays.
Input:
Output:
b. rename the series MTseries as SeriesEmpty.
Input:
Output:
c. name the index of the series monthdays as monthno and that of series friends as fname.
Input:
d. display the 3rd and 2nd value of the series friends, in that order.
Input:
Output:
e. Display the alphabets ‘e’ to ‘p’ from the Series EngAlph.
Input:
Output:
f. display the first 10 values in the Series EngAlph.
Input:
Output:
g. Display the last 10 values in the series EngAlph.
Input:
Output:
h. Display the MTseries.
Input:
Output:
4. Using the Series created in Question 5, write commands for the following:
a) Display the names of the months 3 through 7 from the Series MonthDays.
b) Display the Series MonthDays in reverse order.
5. Create the following DataFrame Sales containing year wise sales figures for five sales persons in
INR. Use the years as column labels, and sales person names as row labels.
2014 2015 2016 2017
Madhu 100.5 12000 20000 50000
Kusum 150.8 18000 50000 60000
Kinshuk 200.9 22000 70000 70000
Ankit 30000 30000 100000 80000
Shruti 40000 45000 125000 90000
6.
(Kips)
7. Mr. Alok from the exam department has created the following DataFrame df in order to
calculate the final result for the students of the Science stream.
Name English Physics Accounts
S No. 1 Vinay 88 77 69
S No. 2 Adith 92 62 88
S No. 3 Mihir 79 71 74
S No. 4 Anil 84 80 81
By mistake , he has mixed the marks of commerce and science streams . Help the class teacher to rectify
the mistakes and calculate the final result.
a. Write a statement to remove the marks of accounts subject from the DataFrame.
Input:-
Output:-
b. Add columns chemistry and mathematics with marks of students given as [78, 61, 54, 81] and
[83, 85, 76, 91].
Input:-
Output:-
c. Add a data of the student rajat with the following details: English:88, chemistry:91, physics:93,
mathematic:87.
Input:-
Output:-
d. Update the marks of roll number 2 from 82 to 92 in English subject.
Input:-
Output:-
e. Calculate the final percentage in a new percentage column after giving 5 grace marks to every
student.
Input:-
Output:-
8. Write a python program to plot a bar graph for the following data:-
Month = [‘jan’, ‘march’, ‘may’, ‘july’]
No. of working days = [24, 21, 22, 25]
Input:-
Output:-
9. Science teacher, miss ranjana, gave a project to her class student bhanu to find the interest of
students to have junk food in lunch or dinner for next 5 days and asked to store data with the
following columns:
Days Lunch Dinner
Monday 20 10
Tuesday 25 15
Wednesday 15 15
Thursday 10 20
Friday 24 6
Input:-
Output:-
10. On every Wednesday, class 5A, 5B, 5C, 5D watches an educational movie. The class teacher has
shown almost 5 movies till now and she has rolled out a form to know which movie their
children like the most. She has the following data:-
Movies Liked by number of
students
1 35
2 40
3 55
4 62
5 38
Input:-
Output:-
11. Write the python code to plot the given histogram with the following data:-
Score = [40, 45, 41, 43, 43, 55, 53, 52, 46, 43, 40, 45, 44, 42, 46, 47, 51, 52, 54]
Input:-
Output:-