Created
January 22, 2016 01:15
-
-
Save talos/1d60c311e3f557b9bd99 to your computer and use it in GitHub Desktop.
Sample of joining together yelp review & business data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def main(): | |
businesses_by_id = {} | |
with open('yelp_academic_dataset_business.json') as business_file: | |
# for every line in this file (every business) | |
# load the json in from that line into an object (json.loads) | |
# | |
# save the object to the businesses_by_id dict by its `business_id` | |
with open('yelp_academic_dataset_review.json') as review_file: | |
# for every line in this file (every review) | |
# load the json in from that line into an object (json.loads) | |
# | |
# look up the business from businesses_by_id by using the `business_id` in the review object you just loaded | |
# | |
# do whatever other processing you want to do now that you've got the business | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment