geoparse.py 文件源码

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

项目:mordecai 作者: openeventdata 项目源码 文件源码
def _feature_most_common(self, results):
        """
        Find the most common country name in ES/Geonames results

        Paramaters
        ----------
        results: dict
            output of `query_geonames`

        Returns
        -------
        most_common: str
            ISO code of most common country, or empty string if none
        """
        try:
            country_count = Counter([i['country_code3'] for i in results['hits']['hits']])
            most_common = country_count.most_common()[0][0]
            return most_common
        except IndexError:
            return ""
        except TypeError:
            return ""
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号