class_docstr: A flexible CSV exporter that represents slice(s) of field values of a
  dataset as columns of a CSV file.
  
  See :ref:`this page <CSVDataset-export>` for exporting datasets of this
  type.
  
  Args:
      export_dir (None): the directory to write the export. This has no
          effect if ``data_path`` and ``labels_path`` are absolute paths
      data_path (None): an optional parameter that enables explicit control
          over the location of the exported media. Can be any of the
          following:
  
          -   a folder name like ``"data"`` or ``"data/"`` specifying a
              subfolder of ``export_dir`` in which to export the media
          -   an absolute directory path in which to export the media. In
              this case, the ``export_dir`` has no effect on the location of
              the data
          -   a JSON filename like ``"data.json"`` specifying the filename of
              the manifest file in ``export_dir`` generated when
              ``export_media`` is ``"manifest"``
          -   an absolute filepath specifying the location to write the JSON
              manifest file when ``export_media`` is ``"manifest"``. In this
              case, ``export_dir`` has no effect on the location of the data
  
          If None, the default value of this parameter will be chosen based
          on the value of the ``export_media`` parameter
      labels_path (None): an optional parameter that enables explicit control
          over the location of the exported labels. Can be any of the
          following:
  
          -   a filename like ``"labels.csv"`` specifying the location in
              ``export_dir`` in which to export the labels
          -   an absolute filepath to which to export the labels. In this
              case, the ``export_dir`` has no effect on the location of the
              labels
  
          If None, the labels will be exported into ``export_dir`` using the
          default filename
      export_media (None): controls how to export the raw media. The
          supported values are:
  
          -   ``True``: copy all media files into the output directory
          -   ``False``: don't export media
          -   ``"move"``: move all media files into the output directory
          -   ``"symlink"``: create symlinks to the media files in the output
              directory
          -   ``"manifest"``: create a ``data.json`` in the output directory
              that maps UUIDs used in the labels files to the filepaths of
              the source media, rather than exporting the actual media
  
          If None, the default value of this parameter will be chosen based
          on the value of the ``data_path`` parameter
      rel_dir (None): an optional relative directory to strip from each input
          filepath to generate a unique identifier for each media. When
          exporting media, this identifier is joined with ``data_path`` to
          generate an output path for each exported media. This argument
          allows for populating nested subdirectories that match the shape of
          the input paths. The path is converted to an absolute path (if
          necessary) via :func:`fiftyone.core.storage.normalize_path`
      abs_paths (False): whether to store absolute paths to the media in the
          exported labels
      media_field ("filepath"): the name of the field containing the media to
          export for each sample
      fields (None): an optional argument specifying the fields or
          ``embedding.field.names`` to include as columns in the exported
          CSV. Can be:
  
          -   a field or iterable of fields
          -   a dict mapping field names to column names
  
          By default, only the ``media_field`` is exported
class_docstr_tok: ["A","flexible","CSV","exporter","that","represents","slice","(","s",")","of","field","values","of","a","dataset","as","columns","of","a","CSV","file",".","See",":","ref",":","`","this","page","<","CSVDataset-export",">","`","for","exporting","datasets","of","this","type",".","Args",":","export_dir","(","None",")",":","the","directory","to","write","the","export",".","This","has","no","effect","if","``","data_path","``","and","``","labels_path","``","are","absolute","paths","data_path","(","None",")",":","an","optional","parameter","that","enables","explicit","control","over","the","location","of","the","exported","media",".","Can","be","any","of","the","following",":","-","a","folder","name","like","``","``","data","''","``","or","``","``","data\/","''","``","specifying","a","subfolder","of","``","export_dir","``","in","which","to","export","the","media","-","an","absolute","directory","path","in","which","to","export","the","media",".","In","this","case",",","the","``","export_dir","``","has","no","effect","on","the","location","of","the","data","-","a","JSON","filename","like","``","``","data.json","''","``","specifying","the","filename","of","the","manifest","file","in","``","export_dir","``","generated","when","``","export_media","``","is","``","``","manifest","''","``","-","an","absolute","filepath","specifying","the","location","to","write","the","JSON","manifest","file","when","``","export_media","``","is","``","``","manifest","''","``",".","In","this","case",",","``","export_dir","``","has","no","effect","on","the","location","of","the","data","If","None",",","the","default","value","of","this","parameter","will","be","chosen","based","on","the","value","of","the","``","export_media","``","parameter","labels_path","(","None",")",":","an","optional","parameter","that","enables","explicit","control","over","the","location","of","the","exported","labels",".","Can","be","any","of","the","following",":","-","a","filename","like","``","``","labels.csv","''","``","specifying","the","location","in","``","export_dir","``","in","which","to","export","the","labels","-","an","absolute","filepath","to","which","to","export","the","labels",".","In","this","case",",","the","``","export_dir","``","has","no","effect","on","the","location","of","the","labels","If","None",",","the","labels","will","be","exported","into","``","export_dir","``","using","the","default","filename","export_media","(","None",")",":","controls","how","to","export","the","raw","media",".","The","supported","values","are",":","-","``","True","``",":","copy","all","media","files","into","the","output","directory","-","``","False","``",":","do","n't","export","media","-","``","``","move","''","``",":","move","all","media","files","into","the","output","directory","-","``","``","symlink","''","``",":","create","symlinks","to","the","media","files","in","the","output","directory","-","``","``","manifest","''","``",":","create","a","``","data.json","``","in","the","output","directory","that","maps","UUIDs","used","in","the","labels","files","to","the","filepaths","of","the","source","media",",","rather","than","exporting","the","actual","media","If","None",",","the","default","value","of","this","parameter","will","be","chosen","based","on","the","value","of","the","``","data_path","``","parameter","rel_dir","(","None",")",":","an","optional","relative","directory","to","strip","from","each","input","filepath","to","generate","a","unique","identifier","for","each","media",".","When","exporting","media",",","this","identifier","is","joined","with","``","data_path","``","to","generate","an","output","path","for","each","exported","media",".","This","argument","allows","for","populating","nested","subdirectories","that","match","the","shape","of","the","input","paths",".","The","path","is","converted","to","an","absolute","path","(","if","necessary",")","via",":","func",":","`","fiftyone.core.storage.normalize_path","`","abs_paths","(","False",")",":","whether","to","store","absolute","paths","to","the","media","in","the","exported","labels","media_field","(","``","filepath","''",")",":","the","name","of","the","field","containing","the","media","to","export","for","each","sample","fields","(","None",")",":","an","optional","argument","specifying","the","fields","or","``","embedding.field.names","``","to","include","as","columns","in","the","exported","CSV",".","Can","be",":","-","a","field","or","iterable","of","fields","-","a","dict","mapping","field","names","to","column","names","By","default",",","only","the","``","media_field","``","is","exported"]
code: def export_samples(self, sample_collection):
      if self._needs_metadata:
          sample_collection.compute_metadata()
  
      idx = self._media_idx
      with fou.ProgressBar(total=len(sample_collection)) as pb:
          for data in pb(zip(*sample_collection.values(self._paths))):
              data = [_parse_value(d) for d in data]
  
              if idx is not None:
                  media_path = data[idx]
                  out_media_path, uuid = self._media_exporter.export(
                      media_path
                  )
                  if self._include_media:
                      data[idx] = (
                          out_media_path if self.abs_paths else uuid
                      )
                  else:
                      data.pop(idx)
  
              self._csv_writer.writerow(data)
  
imports: import csv
  import os
  import eta.core.utils
  import fiftyone.core.utils
  import fiftyone.core.sample
  import fiftyone.utils.data
label_desc: Use image node_id 3 for calling the CSVDatasetExporter obj's underlying member method code with example usage: obj.export_samples(sample_collection) without return types