class_docstr: Creates `Dataset` objects from input CSV files.
  
  This class provides conveniences to load data from CSV files.
  It's possible to directly featurize data from CSV files using
  pandas, but this class may prove useful if you're processing
  large CSV files that you don't want to manipulate directly in
  memory. Note that samples which cannot be featurized are filtered
  out in the creation of final dataset.
  
  Examples
  --------
  Let's suppose we have some smiles and labels
  
  >>> smiles = ["C", "CCC"]
  >>> labels = [1.5, 2.3]
  
  Let's put these in a dataframe.
  
  >>> import pandas as pd
  >>> df = pd.DataFrame(list(zip(smiles, labels)), columns=["smiles", "task1"])
  
  Let's now write this to disk somewhere. We can now use `CSVLoader` to
  process this CSV dataset.
  
  >>> import tempfile
  >>> import deepchem as dc
  >>> with dc.utils.UniversalNamedTemporaryFile(mode='w') as tmpfile:
  ...     df.to_csv(tmpfile.name)
  ...     loader = dc.data.CSVLoader(["task1"], feature_field="smiles",
  ...                              featurizer=dc.feat.CircularFingerprint())
  ...     dataset = loader.create_dataset(tmpfile.name)
  >>> len(dataset)
  2
  
  Of course in practice you should already have your data in a CSV file if
  you're using `CSVLoader`. If your data is already in memory, use
  `InMemoryLoader` instead.
  
  Sometimes there will be datasets without specific tasks, for example
  datasets which are used in unsupervised learning tasks. Such datasets
  can be loaded by leaving the `tasks` field empty.
  
  Example
  -------
  
  >>> x1, x2 = [2, 3, 4], [4, 6, 8]
  >>> df = pd.DataFrame({"x1":x1, "x2": x2}).reset_index()
  >>> with dc.utils.UniversalNamedTemporaryFile(mode='w') as tmpfile:
  ...     df.to_csv(tmpfile.name)
  ...     loader = dc.data.CSVLoader(tasks=[], id_field="index", feature_field=["x1", "x2"],
  ...                              featurizer=dc.feat.DummyFeaturizer())
  ...     dataset = loader.create_dataset(tmpfile.name)
  >>> len(dataset)
  3
class_docstr_tok: ["Creates","`","Dataset","`","objects","from","input","CSV","files",".","This","class","provides","conveniences","to","load","data","from","CSV","files",".","It","'s","possible","to","directly","featurize","data","from","CSV","files","using","pandas",",","but","this","class","may","prove","useful","if","you","'re","processing","large","CSV","files","that","you","do","n't","want","to","manipulate","directly","in","memory",".","Note","that","samples","which","can","not","be","featurized","are","filtered","out","in","the","creation","of","final","dataset",".","Examples","--","--","--","--","Let","'s","suppose","we","have","some","smiles","and","labels",">",">",">","smiles","=","[","``","C","''",",","``","CCC","''","]",">",">",">","labels","=","[","1.5",",","2.3","]","Let","'s","put","these","in","a","dataframe",".",">",">",">","import","pandas","as","pd",">",">",">","df","=","pd.DataFrame","(","list","(","zip","(","smiles",",","labels",")",")",",","columns=","[","``","smiles","''",",","``","task1","''","]",")","Let","'s","now","write","this","to","disk","somewhere",".","We","can","now","use","`","CSVLoader","`","to","process","this","CSV","dataset",".",">",">",">","import","tempfile",">",">",">","import","deepchem","as","dc",">",">",">","with","dc.utils.UniversalNamedTemporaryFile","(","mode=","'","w","'",")","as","tmpfile",":","...","df.to_csv","(","tmpfile.name",")","...","loader","=","dc.data.CSVLoader","(","[","``","task1","''","]",",","feature_field=","''","smiles","''",",","...","featurizer=dc.feat.CircularFingerprint","(",")",")","...","dataset","=","loader.create_dataset","(","tmpfile.name",")",">",">",">","len","(","dataset",")","2","Of","course","in","practice","you","should","already","have","your","data","in","a","CSV","file","if","you","'re","using","`","CSVLoader","`",".","If","your","data","is","already","in","memory",",","use","`","InMemoryLoader","`","instead",".","Sometimes","there","will","be","datasets","without","specific","tasks",",","for","example","datasets","which","are","used","in","unsupervised","learning","tasks",".","Such","datasets","can","be","loaded","by","leaving","the","`","tasks","`","field","empty",".","Example","--","--","--","-",">",">",">","x1",",","x2","=","[","2",",","3",",","4","]",",","[","4",",","6",",","8","]",">",">",">","df","=","pd.DataFrame","(","{","``","x1","''",":","x1",",","``","x2","''",":","x2","}",")",".reset_index","(",")",">",">",">","with","dc.utils.UniversalNamedTemporaryFile","(","mode=","'","w","'",")","as","tmpfile",":","...","df.to_csv","(","tmpfile.name",")","...","loader","=","dc.data.CSVLoader","(","tasks=","[","]",",","id_field=","''","index","''",",","feature_field=","[","``","x1","''",",","``","x2","''","]",",","...","featurizer=dc.feat.DummyFeaturizer","(",")",")","...","dataset","=","loader.create_dataset","(","tmpfile.name",")",">",">",">","len","(","dataset",")","3"]
docstr: Initializes CSVLoader.
  
  Parameters
  ----------
  tasks: List[str]
      List of task names
  featurizer: Featurizer
      Featurizer to use to process data.
  feature_field: str, optional (default None)
      Field with data to be featurized.
  id_field: str, optional, (default None)
      CSV column that holds sample identifier
  smiles_field: str, optional (default None) (DEPRECATED)
      Name of field that holds smiles string.
  log_every_n: int, optional (default 1000)
      Writes a logging statement this often.
docstr_tok: ["Initializes","CSVLoader",".","Parameters","--","--","--","--","--","tasks",":","List","[","str","]","List","of","task","names","featurizer",":","Featurizer","Featurizer","to","use","to","process","data",".","feature_field",":","str",",","optional","(","default","None",")","Field","with","data","to","be","featurized",".","id_field",":","str",",","optional",",","(","default","None",")","CSV","column","that","holds","sample","identifier","smiles_field",":","str",",","optional","(","default","None",")","(","DEPRECATED",")","Name","of","field","that","holds","smiles","string",".","log_every_n",":","int",",","optional","(","default","1000",")","Writes","a","logging","statement","this","often","."]
code: def __init__(
      self,
      tasks: List[str],
      featurizer: Featurizer,
      feature_field: Optional[str] = None,
      id_field: Optional[str] = None,
      smiles_field: Optional[str] = None,
      log_every_n: int = 1000,
  ):
      """Initializes CSVLoader.
  
      Parameters
      ----------
      tasks: List[str]
          List of task names
      featurizer: Featurizer
          Featurizer to use to process data.
      feature_field: str, optional (default None)
          Field with data to be featurized.
      id_field: str, optional, (default None)
          CSV column that holds sample identifier
      smiles_field: str, optional (default None) (DEPRECATED)
          Name of field that holds smiles string.
      log_every_n: int, optional (default 1000)
          Writes a logging statement this often.
      """
      if not isinstance(tasks, list):
          raise ValueError("tasks must be a list.")
      if smiles_field is not None:
          logger.warning(
              "smiles_field is deprecated and will be removed in a future version of DeepChem."
              "Use feature_field instead."
          )
          if (
              feature_field is not None
              and smiles_field != feature_field
          ):
              raise ValueError(
                  "smiles_field and feature_field if both set must have the same value."
              )
          elif feature_field is None:
              feature_field = smiles_field
  
      self.tasks = tasks
      self.feature_field = feature_field
      self.id_field = id_field
      if id_field is None:
          self.id_field = (
              feature_field  # Use features as unique ids if necessary
          )
      else:
          self.id_field = id_field
      self.user_specified_features = None
      if isinstance(featurizer, UserDefinedFeaturizer):
          self.user_specified_features = featurizer.feature_fields
      self.featurizer = featurizer
      self.log_every_n = log_every_n
  
imports: import os
  import tempfile
  import zipfile
  import time
  import logging
  import warnings
  from typing import List, Optional, Tuple, Any, Sequence, Union, Iterator
  import pandas
  import numpy
  from deepchem.utils.typing import OneOrMany
  from deepchem.utils.data_utils import load_image_files, load_csv_files, load_json_files, load_sdf_files, unzip_file
  from deepchem.feat import UserDefinedFeaturizer, Featurizer
  from deepchem.data import Dataset, DiskDataset, NumpyDataset, ImageDataset
  from deepchem.feat.molecule_featurizers import OneHotFeaturizer
  from deepchem.utils.genomics_utils import encode_bio_sequence
label_desc: Use image node_id 1 to create a new CSVLoader object from inherited base classes: DataLoader with example: obj = CSVLoader(tasks, featurizer, feature_field, id_field, smiles_field, log_every_n)