def datetime_average_temperature(self, dt, unit):
        """The daily average temperatures for a particular period.

        Parameters
        ----------
        dt : datetime.datetime or datetime.date
            The date for which to find or calculate the average temperature.
        unit : {"degC", "degF"}
            The unit in which the daily average temperature should be returned.

        Returns
        -------
        out : np.ndarray
            Average temperature observed.
        """

        try:
            value = self.tempC[dt.strftime("%Y-%m-%d")].mean()
            return self._unit_convert(value, unit)
        except KeyError:
            try:
                self._fetch_datetime(dt)
                value = self.tempC[dt.strftime("%Y-%m-%d")].mean()
                return self._unit_convert(value, unit)
            except __HOLE__:
                pass
        return np.nan
dataset/ETHPy150Open impactlab/eemeter/eemeter/weather.py/WeatherSourceBase.datetime_average_temperature