serialize_ena_data_descriptors.py 文件源码

python
阅读 39 收藏 0 点赞 0 评论 0

项目:enasearch 作者: bebatut 项目源码 文件源码
def get_filters(filepath):
    """Extract the filters from the file with description of filters in ENA as
    a dictionary with the key being the filter id and the value a dictionary
    with related results, type of filter, filter description

    filepath: path with csv with filter description
    """
    filters = {}
    with open(filepath, "r") as f:
        reader = csv.DictReader(f, delimiter=';')
        for row in reader:
            filter_id = row["Filter Column"]
            filters.setdefault(filter_id, {})
            filters[filter_id]["results"] = row["Result"].split(", ")
            filters[filter_id]["type"] = row["Type"]
            filters[filter_id]["description"] = ''.join(row["Description"])
    return filters
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号