示例#1
0
 def __init__(self, filename = None, tablename = None):
   self.labels = {}
   self.reverse_labels = {}
   if not filename is None:
     self.name = utils.get_name_for_table(filename) if tablename is None else tablename
     self.dataframe = pd.read_csv(filename,sep='\t',error_bad_lines=False)
     for col in self.dataframe.columns:
       self.labels[col] = [col]
       self.reverse_labels[col] = col
     self.__setup_names()
示例#2
0
 def __init__(self, filename=None, tablename=None):
     self.labels = {}
     self.reverse_labels = {}
     if not filename is None:
         self.name = utils.get_name_for_table(
             filename) if tablename is None else tablename
         self.dataframe = pd.read_csv(filename,
                                      sep='\t',
                                      error_bad_lines=False)
         for col in self.dataframe.columns:
             self.labels[col] = [col]
             self.reverse_labels[col] = col
         self.__setup_names()
示例#3
0
文件: ringo.py 项目: Peratham/ringo
 def add_table(self, filename, tablename = None):
   """
   Adds a new table for the dataset. filename is the name of the file containing
   the table data, and tablename is an optional name for the table. If no 
   name is given, the table name is derived from the name of the file
   (without the extension). The file should be a tab-separated file, and the
   first line of the file should contain the column names.
   """
   if tablename is None:
     tablename = utils.get_name_for_table(filename)
   err_msg = "cannot load table"
   with utils.ringo_open(filename, err_msg):
     #if tablename in self.tablefiles:
     #   print "Table with this name already exists. Changing the source file"
     self.tablefiles[tablename] = filename
示例#4
0
 def add_table(self, filename, tablename=None):
     """
 Adds a new table for the dataset. filename is the name of the file containing
 the table data, and tablename is an optional name for the table. If no 
 name is given, the table name is derived from the name of the file
 (without the extension). The file should be a tab-separated file, and the
 first line of the file should contain the column names.
 """
     if tablename is None:
         tablename = utils.get_name_for_table(filename)
     err_msg = "cannot load table"
     with utils.ringo_open(filename, err_msg):
         #if tablename in self.tablefiles:
         #   print "Table with this name already exists. Changing the source file"
         self.tablefiles[tablename] = filename
示例#5
0
 def load(self, filename, tablename = None):
   if tablename is None:
     tablename = utils.get_name_for_table(filename)
   # If a table with the same name already exists, it is overwritten
   self.tables[tablename] = Table(filename)
示例#6
0
 def load(self, filename, tablename=None):
     if tablename is None:
         tablename = utils.get_name_for_table(filename)
     # If a table with the same name already exists, it is overwritten
     self.tables[tablename] = Table(filename)