original_docstring: 
          The main method to create the database
  
          :return:
          
docstring: The main method to create the database
docstring_tokens: The main method to create the database
code: def build(self, period=120):
          """
          The main method to create the database
  
          :return:
          """
          if self._path:
              data = pd.read_excel(self._path)
          else:
              data = pd.DataFrame()
              for ticker in self._tickers:
                  query = get_raw_data(ticker, self._start)
                  if query.empty:
                      continue
                  print('got the data')
                  _data = process_query(query)
                  print('processed the data')
                  _data = self.featurize(_data)
                  print('featurized the data')
                  freq = (_data.index[1] - _data.index[0]).seconds
                  _data = _data[period:-self._forward//(freq)]
                  data = data.append(_data)
              writer = pd.ExcelWriter('./data.xlsx', engine='xlsxwriter')
              data.to_excel(writer)
              writer.save()
  
          tr_ind = data[data.index.date >= datetime.date(2018, 11, 1)].index
          y_tr = data[data.index.isin(tr_ind)]['Label'].values.astype(int)
          y_ts = data[~data.index.isin(tr_ind)]['Label'].values.astype(int)
          features = [col for col in data.columns if col.startswith('F') or col.startswith('dF')]
          changes = data['Change']
          data = data[features]
          x_tr = data[data.index.isin(tr_ind)].values
          x_tr = x_tr.reshape(x_tr.shape[0], x_tr.shape[1], 1, 1)
          x_ts = data[~data.index.isin(tr_ind)].values
          x_ts = x_ts.reshape(x_ts.shape[0], x_ts.shape[1], 1, 1)
          y_tr = numpy.reshape(y_tr, -1)
          y_ts = numpy.reshape(y_ts, -1)
          dataset = Datasets(train=DataSet(x_tr, y_tr, one_hot=True, hm_classes=self.n_labels),
                             test=DataSet(x_ts, y_ts, one_hot=True, hm_classes=self.n_labels)
                             )
          _, bins = np.histogram(changes.values, bins=self.n_labels)
          return dataset, bins
code_tokens: def build ( self , period = 120 ) : if self . _path : data = pd . read_excel ( self . _path ) else : data = pd . DataFrame ( ) for ticker in self . _tickers : query = get_raw_data ( ticker , self . _start ) if query . empty : continue print ( 'got the data' ) _data = process_query ( query ) print ( 'processed the data' ) _data = self . featurize ( _data ) print ( 'featurized the data' ) freq = ( _data . index [ 1 ] - _data . index [ 0 ] ) . seconds _data = _data [ period : - self . _forward // ( freq ) ] data = data . append ( _data ) writer = pd . ExcelWriter ( './data.xlsx' , engine = 'xlsxwriter' ) data . to_excel ( writer ) writer . save ( ) tr_ind = data [ data . index . date >= datetime . date ( 2018 , 11 , 1 ) ] . index y_tr = data [ data . index . isin ( tr_ind ) ] [ 'Label' ] . values . astype ( int ) y_ts = data [ ~ data . index . isin ( tr_ind ) ] [ 'Label' ] . values . astype ( int ) features = [ col for col in data . columns if col . startswith ( 'F' ) or col . startswith ( 'dF' ) ] changes = data [ 'Change' ] data = data [ features ] x_tr = data [ data . index . isin ( tr_ind ) ] . values x_tr = x_tr . reshape ( x_tr . shape [ 0 ] , x_tr . shape [ 1 ] , 1 , 1 ) x_ts = data [ ~ data . index . isin ( tr_ind ) ] . values x_ts = x_ts . reshape ( x_ts . shape [ 0 ] , x_ts . shape [ 1 ] , 1 , 1 ) y_tr = numpy . reshape ( y_tr , - 1 ) y_ts = numpy . reshape ( y_ts , - 1 ) dataset = Datasets ( train = DataSet ( x_tr , y_tr , one_hot = True , hm_classes = self . n_labels ) , test = DataSet ( x_ts , y_ts , one_hot = True , hm_classes = self . n_labels ) ) _ , bins = np . histogram ( changes . values , bins = self . n_labels ) return dataset , bins
short_docstring: The main method to create the database
short_docstring_tokens: The main method to create the database
comment: """
          The main method to create the database
  
          :return:
          """