Page 121 - IPP-12-2025
P. 121

1. Who developed Python?
                Ans.  Python was developed by Guido van Rossum.
                  2. What is Python? What are the benefits of using Python?
                Ans.  Python  is  a  programming  language  with  objects,  modules,  threads,  exceptions  and  automatic  memory
                    management. The benefits of using Python are that it is simple and easy, portable, extensible, has built-in
                    data structure and is open source.
                  3. How is Python interpreted?
                Ans.  Python  is  an  interpreted  language.  Python  program  runs  directly  from  the  source  code.  It  converts  the
                    source code that is written by the programmer into an intermediate language, which is again translated
                    into the machine language that has to be executed.
                  4. What do you understand by Array slicing?
                Ans.  Array slicing refers to the process of extracting a subset of elements from an existing array and returning
                    the result as another array, possibly in a different dimension from the original.
                  5. What are NumPy arrays?
                Ans.  A NumPy array is a table of elements, all of the same type, indexed by a list/tuple of integers. NumPy arrays
                    are also called ndarrays.
                  6. Why are NumPy arrays used over lists?
                Ans.  NumPy  arrays  have  contiguous  memory  allocation.  Thus,  same  data  elements  in  array  stored  as  lists
                    require more space as compared to arrays.
                      • They are speedier to work with and, hence, more efficient than lists.
                      • They are more convenient to deal with.
                  7. Is Python NumPy better than lists?
                Ans.  Yes,  NumPy  arrays  are  better  than  lists.  We  use  Python  NumPy  array  instead  of  a  list  because  of  the
                    following three reasons:
                     (a) Less memory
                     (b) Fast
                     (c) Convenient
                  8. Who is the main author of Pandas and what is Pandas used for?
                Ans.  Wes McKinney is the author of Pandas.
                    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.
                  9. What is Pandas series?
                Ans.  Pandas series is a one-dimensional labelled data structure  capable  of  holding data of  any type (integer,
                    string, float, Python objects,  etc.) accessed using  respective  data  labels,  called its index.
                 10. What is a Dataframe?
                Ans.  Dataframe  is  a two-dimensional  data  structure  with  heterogeneous  data,  usually  represented  in tabular
                    format. The data is represented in rows and columns. Each column represents an attribute and each row
                    represents a record. Features of Dataframe are:
                      • Potentially, columns are of different types.
                      • Size is mutable.
                      • Labelled axes (rows and columns).
                 11. How is dataframe different from a NumPy 2D array?
                Ans.  Dataframe  can  store  data  of  any  type  whereas  a  NumPy  2D  array  can  contain  data  of  similar  type.
                    Moreover,  dataframe  elements  can  be  accessed  by  their  default  indexes  for  rows  and  columns  along
                    with the defined labels whereas NumPy 2D array can be accessed using default index specifications only.
                    Dataframe is a data structure in the Pandas library having a simpler interface for operations like file loading,
                    plotting, selection, joining and group by, which come in handy in data processing applications.
                 12. How can we create an empty dataframe?
                Ans.  By using the function DataFrame().
   116   117   118   119   120   121   122   123   124   125   126