original_docstring: 
  
          Parameters
          ----------
          df
          table_name: str
              if table_name has file type, then pass through filename without adding model or bundle name prefix
          index: booelan
          append: boolean
          bundle_directory: boolean
  
          
docstring: Parameters
  df
  table_name: str
  if table_name has file type, then pass through filename without adding model or bundle name prefix
  index: booelan
  append: boolean
  bundle_directory: boolean
docstring_tokens: Parameters df table_name : str if table_name has file type then pass through filename without adding model or bundle name prefix index : booelan append : boolean bundle_directory : boolean
code: def write_table(self, df, table_name, index=True, append=True, bundle_directory=False):
          """
  
          Parameters
          ----------
          df
          table_name: str
              if table_name has file type, then pass through filename without adding model or bundle name prefix
          index: booelan
          append: boolean
          bundle_directory: boolean
  
          """
  
          def cache_table(df, table_name, append):
              if table_name in self.tables and not append:
                  raise RuntimeError("cache_table %s append=False and table exists" % (table_name,))
              if table_name in self.tables:
                  self.tables[table_name] = pd.concat([self.tables[table_name], df])
              else:
                  self.tables[table_name] = df.copy()
  
          def write_table(df, table_name, index, append, bundle_directory):
              if table_name.endswith('.csv'):
                  # pass through filename without adding model or bundle name prefix
                  file_path = os.path.join(self.output_directory(bundle_directory), table_name)
              else:
                  file_path = self.output_file_path(table_name, 'csv', bundle_directory)
              file_exists = os.path.isfile(file_path)
              if file_exists and not append:
                  raise RuntimeError("write_table %s append=False and file exists: %s" % (table_name, file_path))
              df.to_csv(file_path, mode='a', index=index, header=(not file_exists))
  
          assert self.estimating
  
          cache = table_name in self.tables_to_cache
          write = not cache
          # write = True
  
          if cache:
              cache_table(df, table_name, append)
              self.debug('write_table cache: %s' % table_name)
  
          if write:
              write_table(df, table_name, index, append, bundle_directory)
              self.debug('write_table write: %s' % table_name)
code_tokens: def write_table ( self , df , table_name , index = True , append = True , bundle_directory = False ) : def cache_table ( df , table_name , append ) : if table_name in self . tables and not append : raise RuntimeError ( "cache_table %s append=False and table exists" % ( table_name , ) ) if table_name in self . tables : self . tables [ table_name ] = pd . concat ( [ self . tables [ table_name ] , df ] ) else : self . tables [ table_name ] = df . copy ( ) def write_table ( df , table_name , index , append , bundle_directory ) : if table_name . endswith ( '.csv' ) : file_path = os . path . join ( self . output_directory ( bundle_directory ) , table_name ) else : file_path = self . output_file_path ( table_name , 'csv' , bundle_directory ) file_exists = os . path . isfile ( file_path ) if file_exists and not append : raise RuntimeError ( "write_table %s append=False and file exists: %s" % ( table_name , file_path ) ) df . to_csv ( file_path , mode = 'a' , index = index , header = ( not file_exists ) ) assert self . estimating cache = table_name in self . tables_to_cache write = not cache if cache : cache_table ( df , table_name , append ) self . debug ( 'write_table cache: %s' % table_name ) if write : write_table ( df , table_name , index , append , bundle_directory ) self . debug ( 'write_table write: %s' % table_name )
short_docstring: Parameters
  df
  table_name: str
  if table_name has file type, then pass through filename without adding model or bundle name prefix
  index: booelan
  append: boolean
  bundle_directory: boolean
short_docstring_tokens: Parameters df table_name : str if table_name has file type then pass through filename without adding model or bundle name prefix index : booelan append : boolean bundle_directory : boolean
comment: """
  
          Parameters
          ----------
          df
          table_name: str
              if table_name has file type, then pass through filename without adding model or bundle name prefix
          index: booelan
          append: boolean
          bundle_directory: boolean
  
          """$SEP$# pass through filename without adding model or bundle name prefix$SEP$# write = True