Esempio n. 1
0
 def __init__(self, input_path, has_header_row=True):
     self.input_path = input_path
     self.has_header_row = has_header_row
     utf8_file_path = filehandler.convert_to_utf8(input_path)
     logger.debug("converted to utf8 at %s" % utf8_file_path)
     self.input_file = codecs.open(utf8_file_path, 'r',
                                   filehandler.ENCODING_UTF_8)
Esempio n. 2
0
 def __init__(self, input_path, has_header_row=True):
     """
     Initialize the object
     """
     utf8_file_path = filehandler.convert_to_utf8(input_path)
     input_file = codecs.open(utf8_file_path, 'r', filehandler.ENCODING_UTF_8)
     try:
         self.table = table.Table.from_csv(input_file,
                                           no_header_row=not has_header_row,
                                           snifflimit=0)
         if (len(self.table) != 2):
             raise ValueError('File has more than two columns')
         else:
             self.graph = nx.from_edgelist(self.table.to_rows())
     except Exception as e:
         logger.error('[CTD] Unable to make table from csv: %s' % e)
Esempio n. 3
0
 def __init__(self, input_path, has_header_row=True):
     """
     Initialize the object
     """
     utf8_file_path = filehandler.convert_to_utf8(input_path)
     input_file = codecs.open(utf8_file_path, 'r',
                              filehandler.ENCODING_UTF_8)
     try:
         self.table = table.Table.from_csv(input_file,
                                           no_header_row=not has_header_row,
                                           snifflimit=0)
         if (len(self.table) != 2):
             raise ValueError('File has more than two columns')
         else:
             self.graph = nx.from_edgelist(self.table.to_rows())
     except Exception as e:
         logger.error('[CTD] Unable to make table from csv: %s' % e)
Esempio n. 4
0
 def __init__(self, input_path, has_header_row=True):
     self.input_path = input_path
     self.has_header_row = has_header_row
     utf8_file_path = filehandler.convert_to_utf8(input_path)
     logger.debug("converted to utf8 at %s" % utf8_file_path)
     self.input_file = codecs.open(utf8_file_path,'r',filehandler.ENCODING_UTF_8)