Python csv.excel_tab() Examples
The following are 12
code examples of csv.excel_tab().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
csv
, or try the search function
.
Example #1
Source File: support.py From opensauce-python with Apache License 2.0 | 6 votes |
def get_test_data(fn, col_name, f0_base, sample): """Get frame and col_name data from output file named by f0_base and sample. That is, given fn, return the data produced from that input file (the filenames appear in the first column), taking the data from the output file whose name has f0_base (sf0, pf0, shrf0, strf0) and sample (1ms, 9seg) in it. Return a list of tuples consisting of the frame offset (t_ms) and the data from the column named by col_name, converted to floats. """ in_name = os.path.splitext(os.path.basename(fn))[0] fn = os.path.join(data_path, 'output-' + f0_base + '-' + sample + '.txt') res = [] with open(fn) as f: c = csv.DictReader(f, dialect=csv.excel_tab) for row in c: if row['Filename'].startswith(in_name): res.append((float(row['t_ms']), float(row[col_name]))) return res
Example #2
Source File: genome_extractor.py From phageParser with MIT License | 5 votes |
def __init__(self, infile, **kwargs): blast_file = open(infile, 'r') self.reader = csv.reader(blast_file, dialect=csv.excel_tab)
Example #3
Source File: find_accession.py From phageParser with MIT License | 5 votes |
def __init__(self, infile, **kwargs): blast_file = open(infile, 'r') self.reader = csv.reader(blast_file, dialect=csv.excel_tab)
Example #4
Source File: 19_tsv-to-csv.py From python-scripts with MIT License | 5 votes |
def convert(input, out): if os.path.exists(out): raise ValueError("Output file already exists") reader = csv.reader(open(input, 'rU'), dialect=csv.excel_tab) writer = csv.writer(open(out, "wb+"), dialect="excel") for row in reader: writer.writerow(row)
Example #5
Source File: suica_read.py From nfcpy-suica-sample with MIT License | 5 votes |
def get_db(cls, filename): # 駅データのcsvを読み込んでキャッシュする if cls.db == None: cls.db = [] for row in csv.reader(open(filename, 'rU'), delimiter=',', dialect=csv.excel_tab): cls.db.append(cls(row)) return cls.db
Example #6
Source File: api.py From td-client-python with Apache License 2.0 | 5 votes |
def _read_tsv_file(self, file_like, **kwargs): return self._read_csv_file(file_like, dialect=csv.excel_tab, **kwargs)
Example #7
Source File: test_helper.py From td-client-python with Apache License 2.0 | 5 votes |
def tsvb(lis, columns=[], encoding="utf-8"): """bytes -> list""" return csvb(lis, columns=columns, dialect=csv.excel_tab, encoding=encoding)
Example #8
Source File: test_helper.py From td-client-python with Apache License 2.0 | 5 votes |
def untsvb(bytes, columns=[], encoding="utf-8"): """bytes -> list""" return uncsvb(bytes, columns=columns, dialect=csv.excel_tab, encoding=encoding)
Example #9
Source File: test_helper.py From td-client-python with Apache License 2.0 | 5 votes |
def dtsvb(lis, encoding="utf-8"): """bytes -> list""" return dcsvb(lis, dialect=csv.excel_tab, encoding=encoding)
Example #10
Source File: test_helper.py From td-client-python with Apache License 2.0 | 5 votes |
def undtsvb(bytes, encoding="utf-8"): """bytes -> list""" return undcsvb(bytes, dialect=csv.excel_tab, encoding=encoding)
Example #11
Source File: markup.py From mindmeld with Apache License 2.0 | 5 votes |
def bootstrap_query_file(input_file, output_file, nlp, **kwargs): """ Apply predicted annotations to a file of text queries Args: input_file (str): filename of queries to be processed output_file (str or None): filename for processed queries nlp (NaturalLanguageProcessor): an application's NLP with built models kwargs (dict): A dictionary of additional args """ show_confidence = kwargs.get("confidence") with open(output_file, "w") if output_file else sys.stdout as csv_file: field_names = ["query"] if not kwargs.get("no_domain"): field_names.append("domain") if show_confidence: field_names.append("domain_conf") if not kwargs.get("no_intent"): field_names.append("intent") if show_confidence: field_names.append("intent_conf") if show_confidence and not kwargs.get("no_entity"): field_names.append("entity_conf") if show_confidence and not kwargs.get("no_role"): field_names.append("role_conf") csv_output = csv.DictWriter(csv_file, field_names, dialect=csv.excel_tab) csv_output.writeheader() for raw_query in mark_down_file(input_file): proc_query = nlp.process_query(nlp.create_query(raw_query), verbose=True) csv_row = bootstrap_query_row(proc_query, show_confidence, **kwargs) csv_output.writerow(csv_row)
Example #12
Source File: question_uploader.py From geosolver with Apache License 2.0 | 5 votes |
def question_uploader_2(root_path, file_name="questions.csv"): """ This is the uploader for the second data set collected by Isaac The root path contains "question.csv" file. headers are: image name, text, choice 1, choice 2, ... , choice 5, answer, ... , is multiple choice :param root_path: :return: """ file_path = os.path.join(root_path, file_name) flag = False with open(file_path, 'rU') as csvfile: reader = csv.reader(csvfile, delimiter=',', dialect=csv.excel_tab) reader.next() for row in reader: image_name = row[0] question_text = row[1] choices = row[2:7] answer = row[7] is_problematic = row[9] == '1' has_choices = row[10] == '1' has_answer = row[11] == '1' """ if image_name == "0510.png": flag = True if not flag: continue """ if is_problematic: continue if has_choices: answer = answer.split(" ")[1] else: choices = [] image_path = os.path.join(root_path, image_name) geoserver_interface.upload_question(question_text, image_path, choices, answer) print(image_name)