code: def resample_to_csv(barFeed, frequency, csvFile):
      """Resample a BarFeed into a CSV file grouping bars by a certain frequency.
      The resulting file can be loaded using :class:`pyalgotrade.barfeed.csvfeed.GenericBarFeed`.
      The CSV file will have the following format:
      ::
  
          Date Time,Open,High,Low,Close,Volume,Adj Close
          2013-01-01 00:00:00,13.51001,13.56,13.51,13.56,273.88014126,13.51001
  
  
      :param barFeed: The bar feed that will provide the bars. It should only hold bars from a single instrument.
      :type barFeed: :class:`pyalgotrade.barfeed.BarFeed`
      :param frequency: The grouping frequency in seconds. Must be > 0.
      :param csvFile: The path to the CSV file to write.
      :type csvFile: string.
  
      .. note::
          * Datetimes are stored without timezone information.
          * **Adj Close** column may be empty if the input bar feed doesn't have that info.
          * Supported resampling frequencies are:
              * Less than bar.Frequency.DAY
              * bar.Frequency.DAY
              * bar.Frequency.MONTH
      """
  
      assert frequency > 0, "Invalid frequency"
      resample_impl(barFeed, frequency, csvFile)
  
file_path: pyalgotrade/pyalgotrade/tools/resample.py
imports: import os
  from pyalgotrade import dispatcher
  from pyalgotrade.dataseries import resampled
label_desc: Use image node_id 2 for calling a global function with example usage: resample_to_csv(barFeed, frequency, csvFile) without return types