class_docstr: (T)ime-(S)eries DataSampler
  This is the result of TSDatasetH
  
  It works like `torch.data.utils.Dataset`, it provides a very convenient interface for constructing time-series
  dataset based on tabular data.
  - On time step dimension, the smaller index indicates the historical data and the larger index indicates the future
    data.
  
  If user have further requirements for processing data, user could process them based on `TSDataSampler` or create
  more powerful subclasses.
  
  Known Issues:
  - For performance issues, this Sampler will convert dataframe into arrays for better performance. This could result
    in a different data type
  
  
  Indices design:
      TSDataSampler has a index mechanism to help users query time-series data efficiently.
  
      The definition of related variables:
          data_arr: np.ndarray
              The original data. it will contains all the original data.
              The querying are often for time-series of a specific stock.
              By leveraging this data charactoristics to speed up querying, the multi-index of data_arr is rearranged in (instrument, datetime) order
  
          data_index: pd.MultiIndex with index order <instrument, datetime>
              it has the same shape with `idx_map`. Each elements of them are expected to be aligned.
  
          idx_map: np.ndarray
              It is the indexable data. It originates from data_arr, and then filtered by 1) `start` and `end`  2) `flt_data`
                  The extra data in data_arr is useful in following cases
                  1) creating meaningful time series data before `start` instead of padding them with zeros
                  2) some data are excluded by `flt_data` (e.g. no <X, y> sample pair for that index). but they are still used in time-series in X
  
              Finnally, it will look like.
  
              array([[  0,   0],
                     [  1,   0],
                     [  2,   0],
                     ...,
                     [241, 348],
                     [242, 348],
                     [243, 348]], dtype=int32)
  
              It list all indexable data(some data only used in historical time series data may not be indexabla), the values are the corresponding row and col in idx_df
          idx_df: pd.DataFrame
              It aims to map the <datetime, instrument> key to the original position in data_arr
  
              For example, it may look like (NOTE: the index for a instrument time-series is continoues in memory)
  
                  instrument SH600000 SH600008 SH600009 SH600010 SH600011 SH600015  ...
                  datetime
                  2017-01-03        0      242      473      717      NaN      974  ...
                  2017-01-04        1      243      474      718      NaN      975  ...
                  2017-01-05        2      244      475      719      NaN      976  ...
                  2017-01-06        3      245      476      720      NaN      977  ...
  
          With these two indices(idx_map, idx_df) and original data(data_arr), we can make the following queries fast (implemented in __getitem__)
          (1) Get the i-th indexable sample(time-series):   (indexable sample index) -> [idx_map] -> (row col) -> [idx_df] -> (index in data_arr)
          (2) Get the specific sample by <datetime, instrument>:  (<datetime, instrument>, i.e. <row, col>) -> [idx_df] -> (index in data_arr)
          (3) Get the index of a time-series data:   (get the <row, col>, refer to (1), (2)) -> [idx_df] -> (all indices in data_arr for time-series)
class_docstr_tok: ["(","T",")","ime-","(","S",")","eries","DataSampler","This","is","the","result","of","TSDatasetH","It","works","like","`","torch.data.utils.Dataset","`",",","it","provides","a","very","convenient","interface","for","constructing","time-series","dataset","based","on","tabular","data",".","-","On","time","step","dimension",",","the","smaller","index","indicates","the","historical","data","and","the","larger","index","indicates","the","future","data",".","If","user","have","further","requirements","for","processing","data",",","user","could","process","them","based","on","`","TSDataSampler","`","or","create","more","powerful","subclasses",".","Known","Issues",":","-","For","performance","issues",",","this","Sampler","will","convert","dataframe","into","arrays","for","better","performance",".","This","could","result","in","a","different","data","type","Indices","design",":","TSDataSampler","has","a","index","mechanism","to","help","users","query","time-series","data","efficiently",".","The","definition","of","related","variables",":","data_arr",":","np.ndarray","The","original","data",".","it","will","contains","all","the","original","data",".","The","querying","are","often","for","time-series","of","a","specific","stock",".","By","leveraging","this","data","charactoristics","to","speed","up","querying",",","the","multi-index","of","data_arr","is","rearranged","in","(","instrument",",","datetime",")","order","data_index",":","pd.MultiIndex","with","index","order","<","instrument",",","datetime",">","it","has","the","same","shape","with","`","idx_map","`",".","Each","elements","of","them","are","expected","to","be","aligned",".","idx_map",":","np.ndarray","It","is","the","indexable","data",".","It","originates","from","data_arr",",","and","then","filtered","by","1",")","`","start","`","and","`","end","`","2",")","`","flt_data","`","The","extra","data","in","data_arr","is","useful","in","following","cases","1",")","creating","meaningful","time","series","data","before","`","start","`","instead","of","padding","them","with","zeros","2",")","some","data","are","excluded","by","`","flt_data","`","(","e.g",".","no","<","X",",","y",">","sample","pair","for","that","index",")",".","but","they","are","still","used","in","time-series","in","X","Finnally",",","it","will","look","like",".","array","(","[","[","0",",","0","]",",","[","1",",","0","]",",","[","2",",","0","]",",","...",",","[","241",",","348","]",",","[","242",",","348","]",",","[","243",",","348","]","]",",","dtype=int32",")","It","list","all","indexable","data","(","some","data","only","used","in","historical","time","series","data","may","not","be","indexabla",")",",","the","values","are","the","corresponding","row","and","col","in","idx_df","idx_df",":","pd.DataFrame","It","aims","to","map","the","<","datetime",",","instrument",">","key","to","the","original","position","in","data_arr","For","example",",","it","may","look","like","(","NOTE",":","the","index","for","a","instrument","time-series","is","continoues","in","memory",")","instrument","SH600000","SH600008","SH600009","SH600010","SH600011","SH600015","...","datetime","2017-01-03","0","242","473","717","NaN","974","...","2017-01-04","1","243","474","718","NaN","975","...","2017-01-05","2","244","475","719","NaN","976","...","2017-01-06","3","245","476","720","NaN","977","...","With","these","two","indices","(","idx_map",",","idx_df",")","and","original","data","(","data_arr",")",",","we","can","make","the","following","queries","fast","(","implemented","in","__getitem__",")","(","1",")","Get","the","i-th","indexable","sample","(","time-series",")",":","(","indexable","sample","index",")","-",">","[","idx_map","]","-",">","(","row","col",")","-",">","[","idx_df","]","-",">","(","index","in","data_arr",")","(","2",")","Get","the","specific","sample","by","<","datetime",",","instrument",">",":","(","<","datetime",",","instrument",">",",","i.e",".","<","row",",","col",">",")","-",">","[","idx_df","]","-",">","(","index","in","data_arr",")","(","3",")","Get","the","index","of","a","time-series","data",":","(","get","the","<","row",",","col",">",",","refer","to","(","1",")",",","(","2",")",")","-",">","[","idx_df","]","-",">","(","all","indices","in","data_arr","for","time-series",")"]
code: def empty(self):
      return len(self) == 0
  
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 8 for calling the TSDataSampler obj's underlying member method code with example usage: obj.empty() and returns: unknown