40 solutions available
Question 37Identify the correct option to select first four rows and second to fourth columns from a DataFrame 'Data':display(Data.iloc[1 : 4, 2 :...
Question 38To delete a column from a DataFrame, you may use ............... statement.removedeldropcancel
Question 39To delete a row from a DataFrame, you may use ............... statement.removedeldropcancel
Question 40Sudhanshu has written the following code to create a DataFrame with boolean index :import numpy as np import pandas as pd df =...
Question 7Consider two objects x and y. x is a list whereas y is a Series. Both have values 20, 40, 90, 110.What will be the output of the following...
Question 8Given a dataframe df as shown below : ABD015171911618202202122What will be the result of following code statements ?(a) df['C'] = np.NaN(b)...
Question 9Write code statements to list the following, from a dataframe namely sales:(a) List only columns 'Item' and 'Revenue'.(b) List rows from 3...
Question 1Consider following Series object namely S :0 0.430271 1 0.617328 2...
Question 2Consider the same Series object, S, given in the previous question. What output will be produced by following code fragment ?S.index =...
Question 4What will be the output produced by following code, considering the Series object S given above ?(a) print(S[1:1])(b) print(S[0:1])(c)...
Question 6(a)Find the error in following code fragment :S2 = pd.Series([101, 102, 102, 104]) print(S2.index) S2.index = [0, 1, 2, 3, 4, 5]...
Question 7Find the Error :data = np.array(['a', 'b', 'c', 'd', 'e', 'f']) s = pd.Series(data, index = [100, 101, 102, 103, 104, 105])...
Question 10If Ser is a Series type object having 30 values, then how are statements (a), (b) and (c), (d) similar and different ?(a)...
Question 11What advantages does dataframe offer over series data structure ? If you have similar data stored in multiple series and a single...
Question 14Given :import pandas as pd d = {'one' : pd.Series([1., 2., 3.], index = ['a', 'b', 'c']), 'two' : pd.Series([1., 2., 3., 4.], index =...
Question 15(a)From the DataFrames created in previous question, write code to display only row 'a' from DataFrames df, df1, and df2.Solutionimport...
Question 15(b)From the DataFrames created in previous question, write code to display only rows 0 and 1 from DataFrames df, df1, and...
Question 15(c)From the DataFrames created in previous question, write code to display only rows 'a' and 'b' for columns 1 and 2 from DataFrames df,...
Question 15(d)From the DataFrames created in previous question, write code to add an empty column 'x' to all DataFrames.Solutionimport pandas as pd d...
Question 16What will be the output of the following program ?import pandas as pd dic = {'Name' : ['Sapna', 'Anmol', 'Rishul', 'Sameep'], 'Agg' : [56,...
Question 17Predict the output of following code (it uses below given dictionary my_di).my_di = {"name" : ["Jiya", "Tim", "Rohan"], "age" :...
Question 18Consider the same dictionary my_di in the previous question (shown below), what will be the output produced by following code ?my_di =...
Question 19Assume that required libraries (panda and numpy) are imported and dataframe df2 has been created as per questions 17 and 18 above. Predict...
Question 20Assume that required libraries (panda and numpy) are imported and dataframe df2 has been created as per questions 17 and 18 above. Predict...
Question 21Assume that required libraries (panda and numpy) are imported and dataframe df2 has been created as per questions 17 and 18 above. Predict...
Question 22Assume that required libraries (panda and numpy) are imported and dataframe df2 has been created as per questions 17 and 18 above. Predict...
Question 23What is the output of the following code ?d = {'col1': [1, 4, 3 ], 'col2': [6, 7, 8], 'col3': [9, 0, 1]} df = pd.DataFrame(d)...
Question 24What is the output of the following code ?data = {'age': [20, 23, 22], 'name': ['Ruhi', 'Ali', 'Sam']} df1 = pd.DataFrame(data, index=[1,...
Question 25Consider the given DataFrame 'Genre' :NoTypeCode0FictionF1Non-fictionNF2DramaD3PoetryPWrite suitable Python statements for the following...
Question 26Write a program in Python Pandas to create the following DataFrame batsman from a Dictionary :B_NONameScore1Score21Sunil Pillai90802Gaurav...
Question 27Consider the following dataframe, and answer the questions given below:import pandas as pd df = pd.DataFrame( { "Quarter1": [2000, 4000,...
Question 28Write the use of the rename(mapper = <dict-like>, axis = 1) method for a Pandas Dataframe. Can the mapper and columns parameter be...
Question 29Find the error in the following code ? Suggest the solution.>>> topDf RollNo Name Marks Sec A 115 Pavni...
Question 30Find the error in the following code considering the same dataframe topDf given in the previous question.(i) topDf.rename(index=['a', 'b',...
Question 3A series object (say T1) stores the average temperature recorded on each day of a month. Write code to display the temperatures recorded on...
Question 5Ekam, a Data Analyst with a multinational brand has designed the DataFrame df that contains the four quarters' sales data of different...
Question 7Write 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...
Question 8Three Series objects store the marks of 10 students in three terms. Roll numbers of students form the index of these Series objects. The...
Question 11Write a program to create three different Series objects from the three rows of a DataFrame df.Solutionimport pandas as pd df =...
Question 12Write a program to create a Series object from an ndarray that stores characters from 'a' to 'g'.Solutionimport pandas as pd import numpy...