1
KENDRIYA VIDYALAYA…………Assignment-1(Python Pandas)1. Answer the following (a) If a Python list is having 7 integers and a numpy array is also having 7 integers, then how are these two data structures similar or different from one another?(b) How is a series object different from and similar to ndarrays ? Support your answer with examples2. (a) Given are two objects, namely LIST1 and a series object namely SERIES1, both are having similar values i.e 2,4,6,8. Find out the output produced by following statements:i. print(LIST1*2)ii. print(SERIES1)(b) Write Python code to create a series object TEMP storing temperatures of 7 days of week. Its indexes should be ‘Sunday,’ .’Monday’,……………………’Saturday’3. (a) How would you add a new column namely ‘VAL’ to a data frame ,DF that has 10 rows in it and has columns as ‘ITEM’,’QTY’,’PRICE’ ? You can choose to put any values of your choice. (b) A data frame STU stores details like ‘NAME’, ‘CLASS’,’SUBJECT_ID’ for 10 students and another data frame ‘MARKS’ stores details like ‘SUBJECT_ID’ and ‘AVG_MARKS’ Write code so that two data frames combine data on the basis of common ‘SUBJECT_ID.(c ) The head() and tail() extract rows or columns from a data frame Explain(d) Why does Python change the data type of a column as soon as it stores an empty value (NaN) even though it has all other values stored as integer?(e) What is the output of the following code: df1= pd. DataFrame ([1, 2 , 3])df2= pd. DataFrame ([[1, 2, 3]])print(“df1”)print(df1)print(“df2”)print(df2)3528060338455ColorCountPriceAppleRed3120AppleGreen9110PearRed25125PearGreen26150LimeGreen99 7000ColorCountPriceAppleRed3120AppleGreen9110PearRed25125PearGreen26150LimeGreen99 704. Given a data frame namely data as shown in adjacent figure (fruit names are row labels). Write code statement to : List fruits with count more than 25.List 2nd, 3rd and 4th rows. 5. Write a Pandas program to create and display a Data Frame from a specified dictionary data which has the index labels.exam_data = {'name': ['Dima', 'James', 'Emily', 'Laura', 'Kevin'], 'score': [9, 16.5, np.nan, 14.5, np.nan], 'attempts': [1, 3, 2, 3, 1], 'qualify': ['yes', 'no', 'yes', 'no', 'no']} labels = ['a', 'b', 'c', 'd', 'e'] 6. Write a Pandas program to change the score in row 'd' to 11.5.exam = {'name': ['Anastasia', 'Dima', 'Emily', 'Laura', 'Kevin'],'score': [np.nan, 9, 20, 14.5, np.nan, 19], 'attempts': [1, 3, 2, 3, 2], 'qualify':['no','yes','yes','no','no']}labels = ['a', 'b', 'd', ‘i', 'j'] 7. Find the index position where the minimum and maximum value exist in Pandas Data Frame8. Find the index position where the minimum and maximum value exist in Pandas Data Frame. 9. How to writing Data Frame to CSV files in pandas? ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- 1 or 2 374 374 1 0 0 0 1 168 1 1 default username and password
- 1 or 3 374 374 1 0 0 0 1 168 1 1 default username and password
- 1 or 2 711 711 1 0 0 0 1 168 1 1 default username and password
- 1 or 3 711 711 1 0 0 0 1 168 1 1 default username and password
- 1 or 2 693 693 1 0 0 0 1 168 1 1 default username and password
- 1 or 3 693 693 1 0 0 0 1 168 1 1 default username and password
- 1 or 2 593 593 1 0 0 0 1 or 2dvchrbu 168 1 1 default username and password
- 1 or 3 593 593 1 0 0 0 1 or 2dvchrbu 168 1 1 default username and password
- 1 or 2 910 910 1 0 0 0 1 168 1 1 default username and password
- 1 or 3 910 910 1 0 0 0 1 168 1 1 default username and password
- 192 1 or 2 33 33 1 0 0 0 1 1 1 default username and password
- 1 or 2 364 364 1 0 0 0 1 168 1 1 admin username and password