Page 112 - IPP-12-2024
P. 112

12.  What do you understand by the size of (i) a Series, (ii) a Dataframe?
             Ans.  Size attribute gives the number of elements present in Series or Dataframes.
              13.  What type of error is returned when the length of index and the length of data in Series() function is not
                 same?
             Ans.  ValueError
              14.  How can we fill missing values in dataframe?
             Ans.  For filling missing values, we can use fillna() method. For example,
                 df = df1.fillna(0)
              15.  Which is the standard data missing marker used in Pandas?
             Ans.  NaN
              16.  Which attribute is used to add a new row and change the data values of a row in a DataFrame ‘df1’?
             Ans.  df1.loc[ ] attribute
              17.  What will the following statement do?

                 Df1 = df.drop(['Name','Class','Rollno'],axis = 1)#Df1 is a dataframe object
             Ans.  It will delete three columns having labels ‘Name’, ‘Class’ and ‘Rollno’ from the dataframe df.
              18.  Which parameter is used to specify row or column in rename() function of dataframe?
             Ans.  index
              19.  Define the following terms:
                  (i)  Median
                  (ii)  Standard deviation
                  (iii)  Variance
             Ans.  (i)  Median: Median refers to the middle value of a given data set.
                  (ii)  Standard deviation: It is measured as the spread of data distribution in the given data set. The built-in
                     function std() is used for calculating the standard deviation for a given data set.
                  (iii)  Variance: It is the average of squared deviations from the mean.
              20.  What difference do we see in deleting with del and pop methods?
             Ans.  del method does not display the contents of the column deleted whereas pop() method deletes an existing
                 column as well as displays the contents of the deleted column.
              21.  Does drop() function delete the column permanently from a dataframe? If not, how can we do that?
             Ans.  No, drop() function does not delete the content until and unless we use inplace=True argument as it makes
                 permanent changes.
              22.  Which library is used for plotting in Python language?
             Ans.  Matplotlib is the library used for plotting in Python language.
              23.  Explain Reindexing in Pandas.
             Ans.  Reindexing means to conform dataframe to a new index placing NA/NaN in locations having no value in
                 the previous index. It changes the row labels and column labels of a dataframe.
              24.  What is Pandas used for?
             Ans.  Pandas library  is written for Python programming  language  for  performing  operations  like  data
                 manipulation, data analysis, etc. The library provides various operations as well as data structures to
                 manipulate time series and numerical tables.
              25.  How can we create an empty dataframe?
             Ans.  By using the function DataFrame().
              26.  Which attribute is used to check if the Series object contains NaN values?
             Ans.  hasnans
              27.  Which object in Pandas cannot grow in size?
             Ans.  Series





            A.22         Informatics Practices with Python–XII
   107   108   109   110   111   112   113   114   115   116