class_docstr: (T)ime-(S)eries Dataset (H)andler
  
  
  Convert the tabular data to Time-Series data
  
  Requirements analysis
  
  The typical workflow of a user to get time-series data for an sample
  - process features
  - slice proper data from data handler:  dimension of sample <feature, >
  - Build relation of samples by <time, instrument> index
      - Be able to sample times series of data <timestep, feature>
      - It will be better if the interface is like "torch.utils.data.Dataset"
  - User could build customized batch based on the data
      - The dimension of a batch of data <batch_idx, feature, timestep>
class_docstr_tok: ["(","T",")","ime-","(","S",")","eries","Dataset","(","H",")","andler","Convert","the","tabular","data","to","Time-Series","data","Requirements","analysis","The","typical","workflow","of","a","user","to","get","time-series","data","for","an","sample","-","process","features","-","slice","proper","data","from","data","handler",":","dimension","of","sample","<","feature",",",">","-","Build","relation","of","samples","by","<","time",",","instrument",">","index","-","Be","able","to","sample","times","series","of","data","<","timestep",",","feature",">","-","It","will","be","better","if","the","interface","is","like","``","torch.utils.data.Dataset","''","-","User","could","build","customized","batch","based","on","the","data","-","The","dimension","of","a","batch","of","data","<","batch_idx",",","feature",",","timestep",">"]
docstr: split the _prepare_raw_seg is to leave a hook for data preprocessing before creating processing data
  NOTE: TSDatasetH only support slc segment on datetime !!!
docstr_tok: ["split","the","_prepare_raw_seg","is","to","leave","a","hook","for","data","preprocessing","before","creating","processing","data","NOTE",":","TSDatasetH","only","support","slc","segment","on","datetime","!","!","!"]
code: def _prepare_seg(self, slc: slice, **kwargs) -> TSDataSampler:
      """
      split the _prepare_raw_seg is to leave a hook for data preprocessing before creating processing data
      NOTE: TSDatasetH only support slc segment on datetime !!!
      """
      dtype = kwargs.pop("dtype", None)
      if not isinstance(slc, slice):
          slc = slice(*slc)
      start, end = slc.start, slc.stop
      flt_col = kwargs.pop("flt_col", None)
      # TSDatasetH will retrieve more data for complete time-series
  
      ext_slice = self._extend_slice(slc, self.cal, self.step_len)
      data = super()._prepare_seg(ext_slice, **kwargs)
  
      flt_kwargs = deepcopy(kwargs)
      if flt_col is not None:
          flt_kwargs["col_set"] = flt_col
          flt_data = super()._prepare_seg(ext_slice, **flt_kwargs)
          assert len(flt_data.columns) == 1
      else:
          flt_data = None
  
      tsds = TSDataSampler(
          data=data,
          start=start,
          end=end,
          step_len=self.step_len,
          dtype=dtype,
          flt_data=flt_data,
      )
      return tsds
  
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 5 for calling the TSDatasetH obj's underlying member method code with example usage: obj._prepare_seg(slc) and returns: tsds