当前位置: 首页>>代码示例>>Python>>正文


Python csv.excel_tab方法代码示例

本文整理汇总了Python中csv.excel_tab方法的典型用法代码示例。如果您正苦于以下问题:Python csv.excel_tab方法的具体用法?Python csv.excel_tab怎么用?Python csv.excel_tab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在csv的用法示例。


在下文中一共展示了csv.excel_tab方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_test_data

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
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 
开发者ID:voicesauce,项目名称:opensauce-python,代码行数:21,代码来源:support.py

示例2: __init__

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
def __init__(self, infile, **kwargs):
        blast_file = open(infile, 'r')
        self.reader = csv.reader(blast_file, dialect=csv.excel_tab) 
开发者ID:phageParser,项目名称:phageParser,代码行数:5,代码来源:genome_extractor.py

示例3: __init__

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
def __init__(self, infile, **kwargs):

        blast_file = open(infile, 'r')
        self.reader = csv.reader(blast_file, dialect=csv.excel_tab) 
开发者ID:phageParser,项目名称:phageParser,代码行数:6,代码来源:find_accession.py

示例4: convert

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
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) 
开发者ID:realpython,项目名称:python-scripts,代码行数:10,代码来源:19_tsv-to-csv.py

示例5: get_db

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
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 
开发者ID:m2wasabi,项目名称:nfcpy-suica-sample,代码行数:9,代码来源:suica_read.py

示例6: _read_tsv_file

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
def _read_tsv_file(self, file_like, **kwargs):
        return self._read_csv_file(file_like, dialect=csv.excel_tab, **kwargs) 
开发者ID:treasure-data,项目名称:td-client-python,代码行数:4,代码来源:api.py

示例7: tsvb

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
def tsvb(lis, columns=[], encoding="utf-8"):
    """bytes -> list"""
    return csvb(lis, columns=columns, dialect=csv.excel_tab, encoding=encoding) 
开发者ID:treasure-data,项目名称:td-client-python,代码行数:5,代码来源:test_helper.py

示例8: untsvb

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
def untsvb(bytes, columns=[], encoding="utf-8"):
    """bytes -> list"""
    return uncsvb(bytes, columns=columns, dialect=csv.excel_tab, encoding=encoding) 
开发者ID:treasure-data,项目名称:td-client-python,代码行数:5,代码来源:test_helper.py

示例9: dtsvb

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
def dtsvb(lis, encoding="utf-8"):
    """bytes -> list"""
    return dcsvb(lis, dialect=csv.excel_tab, encoding=encoding) 
开发者ID:treasure-data,项目名称:td-client-python,代码行数:5,代码来源:test_helper.py

示例10: undtsvb

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
def undtsvb(bytes, encoding="utf-8"):
    """bytes -> list"""
    return undcsvb(bytes, dialect=csv.excel_tab, encoding=encoding) 
开发者ID:treasure-data,项目名称:td-client-python,代码行数:5,代码来源:test_helper.py

示例11: bootstrap_query_file

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
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) 
开发者ID:cisco,项目名称:mindmeld,代码行数:34,代码来源:markup.py

示例12: question_uploader_2

# 需要导入模块: import csv [as 别名]
# 或者: from csv import excel_tab [as 别名]
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) 
开发者ID:uwnlp,项目名称:geosolver,代码行数:43,代码来源:question_uploader.py


注:本文中的csv.excel_tab方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。