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: Defines a generator which returns data for each shard
  
  Parameters
  ----------
  input_files: List[str]
      List of filenames to process
  shard_size: int, optional
      The size of a shard of data to process at a time.
  
  Returns
  -------
  Iterator[pd.DataFrame]
      Iterator over shards
docstr_tok: ["Defines","a","generator","which","returns","data","for","each","shard","Parameters","--","--","--","--","--","input_files",":","List","[","str","]","List","of","filenames","to","process","shard_size",":","int",",","optional","The","size","of","a","shard","of","data","to","process","at","a","time",".","Returns","--","--","--","-","Iterator","[","pd.DataFrame","]","Iterator","over","shards"]
code: def _get_shards(
      self, input_files: List[str], shard_size: Optional[int]
  ) -> Iterator[pd.DataFrame]:
      """Defines a generator which returns data for each shard
  
      Parameters
      ----------
      input_files: List[str]
          List of filenames to process
      shard_size: int, optional
          The size of a shard of data to process at a time.
  
      Returns
      -------
      Iterator[pd.DataFrame]
          Iterator over shards
      """
      return load_csv_files(input_files, shard_size)
  
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 2 for calling the CSVLoader obj's underlying member method code with example usage: obj._get_shards(input_files, shard_size) and returns: load_csv_files