import_data.py 文件源码

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

项目:find-that-charity 作者: TechforgoodCAST 项目源码 文件源码
def clean_chars(chars={}, pc_es=None, es_pc_index="postcode", es_pc_type="postcode"):

    ccount = 0
    for c in chars:
        if pc_es:
            geo_data = fetch_postcode(chars[c]["geo"]["postcode"], pc_es, es_pc_index, es_pc_type)
            if geo_data:
                chars[c]["geo"]["location"] = geo_data[0]
                chars[c]["geo"]["areas"] = geo_data[1]

        chars[c]["url"] = parse_url(chars[c]["url"])
        chars[c]["domain"] = get_domain(chars[c]["url"])
        chars[c]['org-ids'] = add_org_id_prefix(chars[c])

        chars[c]["alt_names"] = [n["name"] for n in chars[c]["names"] if n["name"] != chars[c]["known_as"]]

        # @TODO capitalisation of names

        ccount += 1
        if ccount % 10000 == 0:
            print('\r', "[Geo] %s charites added location details" % ccount, end='')
    print('\r', "[Geo] %s charites added location details" % ccount)

    return chars
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号