Page 24 - Informatics_Practices_Fliipbook_Class12
P. 24

75%      55.0
              max      60.0
              dtype: float64
         >>> #round up to two decimal places
         >>> round(sections.describe(), 2)
              count     7.00
              mean     48.57
              std       9.00
              min      35.00
              25%      42.50
              50%      50.00
              75%      55.00
              max      60.00
              dtype: float64
        For a series such as allSports, comprising categorical values, the method describe() shows the total count of
        values, the number of unique values, the most frequently occurring value (referred to as top), and the frequency of
        occurrence of the top value as shown below:

         >>> allSports.describe()
        output:
              count           9
              unique          5
              top       Cricket
              freq            5
              dtype: object
         >>> allSportsInverted.describe()
        output:
              count         9
              unique        8
              top       India
              freq          2
              dtype: object


          C T  05     Write Python code to provide statistical summary of the series: empNames and empSalary.










               describe(): Returns statistical summary of a series.



        1.5.3 Aggregate Functions and Arithmetic Operations on Series Objects

        Next, suppose, we wish to compute the total sanctioned strength of the class XI. To accomplish this, we intially set
        classStrength as 0. Subsequently, as we iterate through the elements of the Series sections, we add each value
        to classStrength, as shown below:
         >>> '''
         ... Objective: to compute the strength of the class across the sections
         ... Input:     sections- series comprising sections of a class
         ... Output:
         ...     classStrength: total number of students across the sections
         ... '''
         >>> classStrength = 0


          10   Touchpad Informatics Practices-XII
   19   20   21   22   23   24   25   26   27   28   29