Page 43 - Informatics_Practices_Fliipbook_Class12
P. 43

"July","Aug","Sept","Oct","Nov","Dec"])
                    print(month.iloc[2:7])
                  b.  print(month[::-1])
               6.  What is a Series and how is it different from a 1-D array, a list, and a dictionary?
             Ans.   Series is a one-dimenaional data structure of Pandas module that can accomodate objects of various types. Series can be
                  created using any sequence such as lists, numpy array, and dictionary. When we create a series object, Pandas replaces
                  None by NaN.
                  The data labels in series are numeric starting from 0 by default. The data labels are called as indexes.
                  Series vs 1-D array
                  A series allows both default and predefined index labels, accommodating values of any datatype, while a 1-D numpy array
                  is confined to default indexes with elements of the same data type. Series has an index associated with each element which
                  can be customized and can be of any data type, however, NumPy arrays are accessed using integer indices only, and they
                  do not have an explicit index associated with the elements.
                  Series vs List
                  A Series supports both default and predefined index labels, whereas a list is limited to default indexes only.
                  In lists, only basic operations are available, but not as optimized for numerical computations as pandas series.
                  Series vs dictionary
                  A series is a one-dimensional labeled array, while a dictionary is an unordered collection of key-value pairs.





































                                                           Answers

              Multiple Choice Questions
              1. (c)     2. (a)      3. (a)     4. (b)     5. (a)
              True or False
              1. (T)     2. (T)      3. (F)     4. (F)     5. (T)
              Fill in the blanks
              1. series.iloc[:3] or series.head(3)              2. series.describe()        3. series.sum()
              4. series.isnull()           5. +


                                                                                      Data Handling using Pandas  29
   38   39   40   41   42   43   44   45   46   47   48