class_docstr: A flexible CSV importer that represents slice(s) of field values of a
  dataset as columns of a CSV file.
  
  See :ref:`this page <CSVDataset-import>` for format details.
  
  Args:
      dataset_dir (None): the dataset directory. If omitted, ``data_path``
          and/or ``labels_path`` must be provided
      data_path (None): an optional parameter that enables explicit control
          over the location of the media. Can be any of the following:
  
          -   a folder name like ``"data"`` or ``"data/"`` specifying a
              subfolder of ``dataset_dir`` where the media files reside
          -   an absolute directory path where the media files reside. In
              this case, the ``dataset_dir`` has no effect on the location of
              the data
          -   a filename like ``"data.json"`` specifying the filename of the
              JSON data manifest file in ``dataset_dir``
          -   an absolute filepath specifying the location of the JSON data
              manifest. In this case, ``dataset_dir`` has no effect on the
              location of the data
          -   a dict mapping filenames to absolute filepaths
  
          If None, this parameter will default to whichever of ``data/`` or
          ``data.json`` exists in the dataset directory
      labels_path (None): an optional parameter that enables explicit control
          over the location of the labels. Can be any of the following:
  
          -   a filename like ``"labels.csv"`` specifying the location of
              the labels in ``dataset_dir``
          -   an absolute filepath to the labels. In this case,
              ``dataset_dir`` has no effect on the location of the labels
  
          If None, the parameter will default to ``labels.csv``
      media_field ("filepath"): the name of the column containing the media
          path for each sample. The media paths in this column may be:
  
          -   filenames or relative paths to media files in ``data_path``
          -   absolute media paths, in which case ``data_path`` has no effect
      fields (None): an optional parameter that specifies the columns to read
          and parse from the CSV file. Can be any of the following:
  
          -   an iterable of column names to parse as strings
          -   a dict mapping column names to functions that parse the column
              values into the appropriate type. Any keys with ``None`` values
              in this case are directly loaded as strings
  
          If not provided, all columns are parsed as strings
      skip_missing_media (False): whether to skip (True) or raise an error
          (False) when rows with no ``media_field`` are encountered
      include_all_data (False): whether to generate samples for all media in
          the data directory (True) rather than only creating samples for
          media with CSV rows (False)
      shuffle (False): whether to randomly shuffle the order in which the
          samples are imported
      seed (None): a random seed to use when shuffling
      max_samples (None): a maximum number of samples to import. By default,
          all samples are imported
class_docstr_tok: ["A","flexible","CSV","importer","that","represents","slice","(","s",")","of","field","values","of","a","dataset","as","columns","of","a","CSV","file",".","See",":","ref",":","`","this","page","<","CSVDataset-import",">","`","for","format","details",".","Args",":","dataset_dir","(","None",")",":","the","dataset","directory",".","If","omitted",",","``","data_path","``","and\/or","``","labels_path","``","must","be","provided","data_path","(","None",")",":","an","optional","parameter","that","enables","explicit","control","over","the","location","of","the","media",".","Can","be","any","of","the","following",":","-","a","folder","name","like","``","``","data","''","``","or","``","``","data\/","''","``","specifying","a","subfolder","of","``","dataset_dir","``","where","the","media","files","reside","-","an","absolute","directory","path","where","the","media","files","reside",".","In","this","case",",","the","``","dataset_dir","``","has","no","effect","on","the","location","of","the","data","-","a","filename","like","``","``","data.json","''","``","specifying","the","filename","of","the","JSON","data","manifest","file","in","``","dataset_dir","``","-","an","absolute","filepath","specifying","the","location","of","the","JSON","data","manifest",".","In","this","case",",","``","dataset_dir","``","has","no","effect","on","the","location","of","the","data","-","a","dict","mapping","filenames","to","absolute","filepaths","If","None",",","this","parameter","will","default","to","whichever","of","``","data\/","``","or","``","data.json","``","exists","in","the","dataset","directory","labels_path","(","None",")",":","an","optional","parameter","that","enables","explicit","control","over","the","location","of","the","labels",".","Can","be","any","of","the","following",":","-","a","filename","like","``","``","labels.csv","''","``","specifying","the","location","of","the","labels","in","``","dataset_dir","``","-","an","absolute","filepath","to","the","labels",".","In","this","case",",","``","dataset_dir","``","has","no","effect","on","the","location","of","the","labels","If","None",",","the","parameter","will","default","to","``","labels.csv","``","media_field","(","``","filepath","''",")",":","the","name","of","the","column","containing","the","media","path","for","each","sample",".","The","media","paths","in","this","column","may","be",":","-","filenames","or","relative","paths","to","media","files","in","``","data_path","``","-","absolute","media","paths",",","in","which","case","``","data_path","``","has","no","effect","fields","(","None",")",":","an","optional","parameter","that","specifies","the","columns","to","read","and","parse","from","the","CSV","file",".","Can","be","any","of","the","following",":","-","an","iterable","of","column","names","to","parse","as","strings","-","a","dict","mapping","column","names","to","functions","that","parse","the","column","values","into","the","appropriate","type",".","Any","keys","with","``","None","``","values","in","this","case","are","directly","loaded","as","strings","If","not","provided",",","all","columns","are","parsed","as","strings","skip_missing_media","(","False",")",":","whether","to","skip","(","True",")","or","raise","an","error","(","False",")","when","rows","with","no","``","media_field","``","are","encountered","include_all_data","(","False",")",":","whether","to","generate","samples","for","all","media","in","the","data","directory","(","True",")","rather","than","only","creating","samples","for","media","with","CSV","rows","(","False",")","shuffle","(","False",")",":","whether","to","randomly","shuffle","the","order","in","which","the","samples","are","imported","seed","(","None",")",":","a","random","seed","to","use","when","shuffling","max_samples","(","None",")",":","a","maximum","number","of","samples","to","import",".","By","default",",","all","samples","are","imported"]
code: def __next__(self):
      filepath = next(self._iter_filepaths)
  
      row = self._rows_map.get(filepath, None)
      if row is None:
          return fos.Sample(filepath=filepath)
  
      kwargs = {}
      if isinstance(self._fields, dict):
          for key, parser in self._fields.items():
              value = row.get(key, "")
              if value:
                  kwargs[key] = parser(value)
      elif self._fields is not None:
          for key in self._fields:
              value = row.get(key, "")
              if value:
                  kwargs[key] = value
      else:
          for key, value in row.items():
              if value:
                  kwargs[key] = value
  
      return fos.Sample(filepath=filepath, **kwargs)
  
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 4 for calling the CSVDatasetImporter obj's underlying member method code with example usage: obj.__next__() and returns: fos, fos