本文整理汇总了Python中models.Location.categories方法的典型用法代码示例。如果您正苦于以下问题:Python Location.categories方法的具体用法?Python Location.categories怎么用?Python Location.categories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Location
的用法示例。
在下文中一共展示了Location.categories方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: INTEREST
# 需要导入模块: from models import Location [as 别名]
# 或者: from models.Location import categories [as 别名]
#
# POINTS OF INTEREST (YELP)
#
# we do just the normal points of interest first, not groceries/parks/etc
os.chdir(os.path.join(data_base, 'yelp'))
points_of_interest = []
with open('yelp_all_processed.json', 'r') as f:
dct = json.load(f)
for i, e in enumerate(dct):
l = Location()
l.name = e['name']
l.rank = i + 1
l.rating = e['rating']
l.review_count = e['review_count']
l.address = e['address'][0]
l.categories = e['categories']
l.geom = 'POINT ({:.8f} {:.8f})'.format(e['longitude'], e['latitude'])
points_of_interest.append(l)
db_session.add_all(points_of_interest)
db_session.commit()