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()
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()
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
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
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)
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)