44 solutions available
Question 2Assertion (A): A series stores data row-wise.Reasoning (R): A series is a one-dimensional labelled data structure.Both A and R are true and...
Question 3Assertion (A): Dataframe has both a row and column index.Reasoning (R): Dataframe is a two-dimensional labelled data structure like a table...
Question 4Assertion (A): While creating a series using scalar values, index must be provided.Reasoning (R): The scalar value is repeated to match the...
Question 6Assertion (A): After running the following code:df = pd.DataFrame([11,46], index = ['True', 'False']) print(df[True])A key error will be...
Question 10Which of the following commands shows the information with city="Delhi" from dataframe SHOP?print(SHOP[City ==...
Question 1What is the significance of Pandas Library?
Question 7How can we create CSV file? Explain with steps.
Question 8How do you iterate over a dataframe? Explain with the help of code snippet.
Question 9Write commands to print the following details of a series object seal.(a) If the series is empty(b) Indexes of the series(c) The data type...
Question 11Consider the following tables Item and Customer and answer the questions that follow:Table:...
Question 12Consider the following series object namely S:0 0.430271 1 0.617328 2 0.265421 3 0.836113 dtype: float64 What will be returned by the...
Question 13What will be the output produced by the following code?Stationery = ['pencils', 'notebooks', 'scales', 'erasers'] S = pd.Series([20, 33,...
Question 14What will be the output produced by the following codes, considering the Series object S given in Q.13?(a) print(S[1:4])(b)...
Question 15Write a program to iterate and print a dataframe column-wise and print only first three columns.Solutionimport pandas as pd data = {...
Question 16Write a program to iterate and print a dataframe row-wise at a time and print only first five rows.Solutionimport pandas as pd data = {...
Question 17(a)Find the error in the following code fragments:S2 = pd.Series([101, 102, 1-2, 104]) print (S2.index) S2.index = [0.1.2.3, 4, 5] S2[5] =...
Question 17(b)Find the error in the following code fragments:S = pd.Series(2, 3, 4, 55, index = range (4))
Question 17(c)Find the error in the following code fragments:S1 = pd.Series(1, 2, 3, 4, index = range(7))
Question 17(d)Find the error in the following code fragments:S2 = pd.Series([1, 2, 3, 4, 5], index = range(4))
Question 18Find the error:data = np.array(['a', 'b', 'c', 'd', 'e', 'f']) s = pd.Series (data, index=[100, 101, 102, 103, 104, 105])...
Question 19Why does the following code cause error?s1 = pd.Series(range 1, 15, 5), index = list('ababa') print(s1['ab'])
Question 20Consider the following Class12.csv file containing the data as given below:RollNoNameAccountsMathsBStIPEco10Ritu Jain886787975611Mridul...
Question 21Write a program that reads students marks from a ‘Result.csv’ file and displays percentage of each student.Solutionimport pandas as pd df...
Question 22Write the name of function to store data from a dataframe into a CSV file.
Question 23How can we import specific columns from a CSV file?
Question 24What are the advantages of CSV file formats?
Question 25What all libraries do you require in order to bring data from a CSV file into a dataframe?
Question 26You want to read data from a CSV file in a dataframe but you want to provide your own column names to the dataframe. What additional...
Question 27By default, read_csv() uses the value of first row as column headers in dataframes. Which argument will you give to ensure that the...
Question 28Which argument would you give to read.csv() if you only want to read top 10 rows of data?
Question 29Create the following dataframe by the name Project regarding a competition and answer the questions given below:Enrolment...
Question 30Consider the following dataframe: CORONA and answer the questions given...
Question 31Create a dataframe ‘Student’ from two series—Name and Grade, Name and Marks of five students.(a) Display the first three records from...
Question 32Create a dataframe of dictionary consisting of Name, Sub1, Sub2, Sub3, Sub4, Sub5 of five students.(a) Display the dataframe.(b) Display...
Question 33Create two dataframes of salary of five employees and do the following:(a) Display both the dataframes.(b) Add 5000 as bonus in both...
Question 34Create a dataframe using list [10, 11, 12, 13, 14] [23, 34, 45, 32, 65] [55, 60, 65, 70, 75] and do the following:(a) Display the...
Question 35Create a dataframe of [23, 25], [34], [43, 44, 45, 46] and do the following: :(a) Display the dataframe. Notice that the missing value is...
Question 36Create a dataframe of D1 and D2;D1 = {‘Rollno’ : [1001, 1004, 1005, 1008, 1009], ‘Name’: [‘Sarika’, ‘Abhay’, ‘Mohit’, ‘Ruby’, ‘Govind’...
Question 37Create a dataframe of {‘A’ : [ ]} and display whether it is empty or not.Solutionimport pandas as pd df = pd.DataFrame({'A': []})...
Question 38Create a dataframe of {‘A’ : [5, 6], ‘B’: [3, 0], 'C': [0, 0]} and display the result of all() and any() functions.Solutionimport pandas...
Question 39Create a dataframe of {‘A’ : [True, True], ‘B’: [True, False], ‘C’: [False, False]} and display the result of all() and...
Question 40What is the use of statement: inplace=True?
Question 41Differentiate between del, pop() and drop() functions.
Question 5The value NA/NAT/None are the same in Pandas and considered as NaN-values.