<jupyter_start><jupyter_text>Board game data compilation Import libraries<jupyter_code>import pandas as pd
import json
from pandas.io.json import json_normalize
import requests
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import sklearn<jupyter_output><empty_output><jupyter_text>Client id for boardgameatlas.com<jupyter_code>client_id = ""
client_secret = ""<jupyter_output><empty_output><jupyter_text>Query all, ordering by popularity, receive as a json file, then normalize the json file<jupyter_code>url = "https://www.boardgameatlas.com/api/search?order_by=popularity&ascending=false&skip="+str(0)+"&client_id="
#results = requests.get(url).json()
##game_review = json_normalize(results_review['reviews'])
results = requests.get(url).json()<jupyter_output><empty_output><jupyter_text>Convert json to data frame Look at resulting json normalized file<jupyter_code>games = json_normalize(results['games'])
gamepdf = pd.DataFrame(gamedf)<jupyter_output><empty_output><jupyter_text>Get the most popular 7400 games<jupyter_code>#for i in range(1,75):
	skip = i*100
	url = "https://www.boardgameatlas.com/api/search?order_by=popularity&ascending=false&skip="+str(skip)+"&client_id=7RHUoCcqtp"
	results = requests.get(url).json()
	gamedf = json_normalize(results,'games')
	gamepdf = pd.DataFrame(gamedf)
	games2 = games2.append(gamepdf,ignore_index=True, sort=False)<jupyter_output><empty_output><jupyter_text>Save results to import<jupyter_code>games2.to_csv('Games7400.csv',index=False)<jupyter_output><empty_output><jupyter_text>Read in stored query results<jupyter_code>games2=pd.read_csv('Games7400.csv')
len(games2)<jupyter_output><empty_output><jupyter_text>Read in stored games csv<jupyter_code>ind = ['name','average_user_rating', 'min_age']
games3[games3['name'].str.contains("oot", na=False)][ind]
games3[games3['name'].str.contains("Out|out", na=False)].name
gamesub =['name','average_user_rating','max_players', 'max_playtime', 
       'min_age', 'min_players', 'min_playtime', 'msrp']
gamesnumcol = games3[gamesub]
gsort[(gsort['average_user_rating']>4)]
sns.jointplot(x=temp['msrp'], y=temp['max_playtime'], kind='kde')<jupyter_output><empty_output><jupyter_text>Check distribution of number of user ratings per game<jupyter_code>sns.boxplot(x="num_user_ratings", data=games2,palette="Greens_d")<jupyter_output><empty_output><jupyter_text>Board Game Geek section<jupyter_code>url = "http://www.boardgamegeek.com/xmlapi/search?search=Nemesis"
r = requests.get(url)
page_source = r.text
page_source
r.text
page_source.replace("\t", "")
url2 = "http://www.boardgamegeek.com/xmlapi2/thing?id=167355&stats=1"
r2 = requests.get(url2)
page_source2 = r2.text
z=page_source2.replace("\t", "")
z.replace("\n","")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14605120807789398, 'fraction_numerical': 0.016588532275513886, 'mean_word_length': 10.185483870967742, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 42, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '387876', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1020, 'n_words': 150, 'path': 'Games_Initial_Data.ipynb', 'repo_name': 'wendysphillips/Insight_Into_BoardGames', 'size': '2773'}