class_docstr: Dataset with Data(H)andler
  
  User should try to put the data preprocessing functions into handler.
  Only following data processing functions should be placed in Dataset:
  
  - The processing is related to specific model.
  
  - The processing is related to data split.
class_docstr_tok: ["Dataset","with","Data","(","H",")","andler","User","should","try","to","put","the","data","preprocessing","functions","into","handler",".","Only","following","data","processing","functions","should","be","placed","in","Dataset",":","-","The","processing","is","related","to","specific","model",".","-","The","processing","is","related","to","data","split","."]
docstr: Setup the underlying data.
  
  Parameters
  ----------
  handler : Union[dict, DataHandler]
      handler could be:
  
      - instance of `DataHandler`
  
      - config of `DataHandler`.  Please refer to `DataHandler`
  
  segments : dict
      Describe the options to segment the data.
      Here are some examples:
  
      .. code-block::
  
          1) 'segments': {
                  'train': ("2008-01-01", "2014-12-31"),
                  'valid': ("2017-01-01", "2020-08-01",),
                  'test': ("2015-01-01", "2016-12-31",),
              }
          2) 'segments': {
                  'insample': ("2008-01-01", "2014-12-31"),
                  'outsample': ("2017-01-01", "2020-08-01",),
              }
docstr_tok: ["Setup","the","underlying","data",".","Parameters","--","--","--","--","--","handler",":","Union","[","dict",",","DataHandler","]","handler","could","be",":","-","instance","of","`","DataHandler","`","-","config","of","`","DataHandler","`",".","Please","refer","to","`","DataHandler","`","segments",":","dict","Describe","the","options","to","segment","the","data",".","Here","are","some","examples",":","..","code-block",":",":","1",")","'segments","'",":","{","'train","'",":","(","``","2008-01-01","''",",","``","2014-12-31","''",")",",","'valid","'",":","(","``","2017-01-01","''",",","``","2020-08-01","''",",",")",",","'test","'",":","(","``","2015-01-01","''",",","``","2016-12-31","''",",",")",",","}","2",")","'segments","'",":","{","'insample","'",":","(","``","2008-01-01","''",",","``","2014-12-31","''",")",",","'outsample","'",":","(","``","2017-01-01","''",",","``","2020-08-01","''",",",")",",","}"]
code: def __init__(
      self,
      handler: Union[Dict, DataHandler],
      segments: Dict[Text, Tuple],
      fetch_kwargs: Dict = {},
      **kwargs,
  ):
      """
      Setup the underlying data.
  
      Parameters
      ----------
      handler : Union[dict, DataHandler]
          handler could be:
  
          - instance of `DataHandler`
  
          - config of `DataHandler`.  Please refer to `DataHandler`
  
      segments : dict
          Describe the options to segment the data.
          Here are some examples:
  
          .. code-block::
  
              1) 'segments': {
                      'train': ("2008-01-01", "2014-12-31"),
                      'valid': ("2017-01-01", "2020-08-01",),
                      'test': ("2015-01-01", "2016-12-31",),
                  }
              2) 'segments': {
                      'insample': ("2008-01-01", "2014-12-31"),
                      'outsample': ("2017-01-01", "2020-08-01",),
                  }
      """
      self.handler: DataHandler = init_instance_by_config(
          handler, accept_types=DataHandler
      )
      self.segments = segments.copy()
      self.fetch_kwargs = copy(fetch_kwargs)
      super().__init__(**kwargs)
  
imports: from ...utils.serial import Serializable
  from typing import Callable, Union, List, Tuple, Dict, Text, Optional
  from ...utils import init_instance_by_config, np_ffill, time_to_slc_point
  from ...log import get_module_logger
  from .handler import DataHandler, DataHandlerLP
  from copy import copy, deepcopy
  from inspect import getfullargspec
  import pandas
  import numpy
  import bisect
  from ...utils import lazy_sort_index
  from .utils import get_level_index
label_desc: Use image node_id 1 to create a new DatasetH object from inherited base classes: Dataset with example: obj = DatasetH(handler, segments, fetch_kwargs)