Page 351 - Informatics_Practices_Fliipbook_Class12
P. 351

35.  Consider the following Pandas Series:

                      compLanguagesStudied = pd.Series(['Python', 'C++', 'Java', 'HTML']).
                  Determine the output on the execution of the following Python statement:

                      'Python' in compLanguagesStudied
              36.  Consider the following Pandas Series:

                  rollNums=[1,2,3,4]
                  XIIMarks= pd.Series([90, 89, 60, 92], index= rollNums)
                  Determine the output on the execution of the following statements:

                  (i)  XIIMarks.loc[1]
                  (ii)  XIIMarks.iloc[1]
                  (iii)  XIIMarks[1]
                  (iv)  XIIMarks + 5

              37.  Define Pandas data structure DataFrame.
             Ans: Pandas DataFrame is a twodimensional tabular structure that can accommodate objects of various types. It
                  enables us to store and manipulate tabular data efficiently.

              38.  Determine the Pandas methods that can be used to  read following objects to a DataFrame:
                  (i)  Dictionary
                  (ii)  CSV file
                  (iii)  List of lists

             Ans: (i)  pd.DataFrame()
                  (ii)  pd.read_csv()
                  (iii)  pd.DataFrame()

              39.  Which Pandas DataFrame attribute can be used to retrieve the following information:
                  (i)  Number of dimensions of a DataFrame
                  (ii)  Number of rows and columns in a DataFrame
                  (iii)  Row labels of a DataFrame

                  (iv)  Column names of a DataFrame

             Ans: (i)  ndim
                  (ii)  shape
                  (iii)  index

                  (iv)  column
              40.  What is the difference between loc and iloc attribute of Pandas Series?
             Ans. The loc method is used to access elements in a Pandas DataFrame using label-based indexing, while the
                  iloc method is used to access elements in a Pandas DataFrame using integer positional indexing.

              41.  What is the difference between info() and describe() method of Pandas DataFrame.
             Ans. The info() method of a DataFrame provides the following summary information about a DataFrame:

                  • The number of rows, and the row indexes.

                  • The names of columns, the number of non-null entries in each column, and the type objects in each column

                                                                                            Viva Voce Questions  337
   346   347   348   349   350   351   352   353   354   355   356