code: def temperature_data_to_csv(temperature_data, path_or_buf):
      
      if temperature_data.index.name is None:
          temperature_data.index.name = "dt"
      if temperature_data.name is None:
          temperature_data.name = "temperature"
      return temperature_data.to_frame().to_csv(path_or_buf, index=True)
docs: Write temperature data to CSV. See also :any:`pandas.DataFrame.to_csv`.
  
      Parameters
      ----------
      temperature_data : :any:`pandas.Series`
          Temperature data series with :any:`pandas.DatetimeIndex`.
      path_or_buf : :any:`str` or file handle, default None
          File path or object, if None is provided the result is returned as a string.