code: def weighted_temperature(self, how='geometric_series'):
          r
  
          # calculate daily mean temperature
          temperature = self.df['temperature'].resample('D').mean().reindex(
              self.df.index).fillna(method='ffill').fillna(method='bfill')
  
          if how == 'geometric_series':
              temperature_mean = (temperature + 0.5 * np.roll(temperature, 24) +
                                  0.25 * np.roll(temperature, 48) +
                                  0.125 * np.roll(temperature, 72)) / 1.875
          elif how == 'mean':
              temperature_mean = temperature
          else:
              temperature_mean = None
  
          return temperature_mean
docs: r"""
          A new temperature vector is generated containing a multi-day
          average temperature as needed in the load profile function.
  
          Parameters
          ----------
          how : string
              string which type to return ("geometric_series" or "mean")
  
          Notes
          -----
          Equation for the mathematical series of the average
          tempaerature [1]_:
  
          .. math::
              T=\frac{T_{D}+0.5\cdot T_{D-1}+0.25\cdot T_{D-2}+
                      0.125\cdot T_{D-3}}{1+0.5+0.25+0.125}
  
          with :math:`T_D` = Average temperature on the present day
               :math:`T_{D-i}` = Average temperature on the day - i
  
          References
          ----------
          .. [1] `BDEW <https://www.avacon.de/cps/rde/xbcr/avacon/15-06-30_Leitfaden_Abwicklung_SLP_Gas.pdf>`_,
              BDEW Documentation for heat profiles.