Python Pandas-1 || Type C || Class 12 || Sumita Arora || Solution


Q1. Write Python code to create a Series object Temp1 that stores temperatures of seven days in it. Take any random seven temperatures.



Q2. Write Python code to create a Series object Temp2 storing temperatures of seven days of week. Its indexes should be ‘Sunday'. Monday'. ‘Saturday’.



Q3. A series object (say T1) stores the average temperature recorded on each day of a month. Write code to display the temperatures recorded on:
(i) First 7 days
(ii) Last 7 days.




Q4. Series objects Temp1, Temp2, Temp3, Temp4 store the temperatures of days of week1, week2, week3, weeken4 respectively. Write a script to
(a) Print the average temperature per week
(b) Print average temperature of entire month.




Q5. Write a program that stores the sales of 5 fast moving items of a store for each month in 12 Series objects, i.e., S1 Series object stores sales of these 5 items in 1st month, S2 stores sales of these 5 items in 2nd month, and so on.

The program should display the summary sales report like this:

Total Yearly Sales, item-cerise (should display stem of items’ sales over the months)
Maximum sales of item made: <name of item that was sold the maximum in whole year>
Maximum sales for individual items
Maximum sales of item 1 made: <month in which that item sold the maximum>
Maximum sales of item 2 made: <month in which that item sold the maximum>
Maximum sales of item 3 made: <month in which that item sold the maximum>
Maximum sales of item 4 made: <month in which that item sold the maximum>
Maximum sales of item 5 made: <month in which that item sold the maximum>




Q6. Three Series objects store the marks of 10 students in three terms. Roll numbers of students from the index of these Series objects. The Three Series objects have the same indexes.

Calculate the total weighted marks obtained by students as per following formula:

Final marks = 25%. Term 1 + 25% Term 2 + 50% Term 3

Store the Final marks of students in another Series object.




 

Q7. Write code to print all the information about a Series object.



Q8. Write a program to create three different Series objects from the three columns of a DataFrame df.




Q9. Write a program to create three different Series objects from the three rows of a DataFrame df.



Q10. Write a program to create a Series object from an ndarray that stores characters from ‘a’ to ‘g’.



Q11. Write a program to create a Series object that stores the table of number 5.



Q12. Write a program to create a Dataframe that stores two columns, which store the Series objects of the previous two questions (10 and 11).



Q13. Write a program to create a Dataframe storing salesmen details (name, zone, sales) of five salesmen.



Q14. Four dictionaries store the details of four employees-of-the-month as (empno, name). Write a program to create a dataframe from these.



Q15. A list stores three dictionaries each storing details, (old price, new price, change). Write a program to create a dataframe from it.



1 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post