class_docstr: Dynamic Instruments Filter Abstract class to filter a series of certain features
  
  Filters should provide parameters:
  
  - filter start time
  - filter end time
  - filter rule
  
  Override __init__ to assign a certain rule to filter the series.
  
  Override _getFilterSeries to use the rule to filter the series and get a dict of {inst => series}, or override filter_main for more advanced series filter rule
class_docstr_tok: ["Dynamic","Instruments","Filter","Abstract","class","to","filter","a","series","of","certain","features","Filters","should","provide","parameters",":","-","filter","start","time","-","filter","end","time","-","filter","rule","Override","__init__","to","assign","a","certain","rule","to","filter","the","series",".","Override","_getFilterSeries","to","use","the","rule","to","filter","the","series","and","get","a","dict","of","{","inst","=",">","series","}",",","or","override","filter_main","for","more","advanced","series","filter","rule"]
docstr: Convert the target timestamp to a pandas series of bool value within a time range.
      Make the time inside the target_timestamp range TRUE, others FALSE.
  
  Parameters
  ----------
  time_range : D.calendar
      the time range of the instruments.
  target_timestamp : list
      the list of tuple (timestamp, timestamp).
  
  Returns
  ----------
  pd.Series
      the series of bool value for an instrument.
docstr_tok: ["Convert","the","target","timestamp","to","a","pandas","series","of","bool","value","within","a","time","range",".","Make","the","time","inside","the","target_timestamp","range","TRUE",",","others","FALSE",".","Parameters","--","--","--","--","--","time_range",":","D.calendar","the","time","range","of","the","instruments",".","target_timestamp",":","list","the","list","of","tuple","(","timestamp",",","timestamp",")",".","Returns","--","--","--","--","--","pd.Series","the","series","of","bool","value","for","an","instrument","."]
code: def _toSeries(self, time_range, target_timestamp):
      """Convert the target timestamp to a pandas series of bool value within a time range.
          Make the time inside the target_timestamp range TRUE, others FALSE.
  
      Parameters
      ----------
      time_range : D.calendar
          the time range of the instruments.
      target_timestamp : list
          the list of tuple (timestamp, timestamp).
  
      Returns
      ----------
      pd.Series
          the series of bool value for an instrument.
      """
      # Construct a whole dict of {date => bool}
      timestamp_series = {timestamp: False for timestamp in time_range}
      # Convert to pd.Series
      timestamp_series = pd.Series(timestamp_series)
      # Fill the date within target_timestamp with TRUE
      for start, end in target_timestamp:
          timestamp_series[
              Cal.calendar(
                  start_time=start, end_time=end, freq=self.filter_freq
              )
          ] = True
      return timestamp_series
  
imports: from __future__ import print_function
  from abc import abstractmethod
  import re
  import pandas
  import numpy
  import abc
  from .data import Cal, DatasetD
label_desc: Use image node_id 3 for calling the SeriesDFilter obj's underlying member method code with example usage: obj._toSeries(time_range, target_timestamp) and returns: timestamp_series