In [2]:
import numpy as np
import time

t = time.time()

base = np.asarray(range(15000))

for _ in range(10000):
    result = np.isin(base, np.asarray([10, 100, 200, 300, 400, 500, 1000, 1500, 6756, 11245, 14672,
                                       2000, 3532, 5234, 1234, 4763, 5764, 7456, 3673, 11111]))
    
print(time.time() - t)


1.8744840621948242

In [24]:
import json

# appids given by steam via http://api.steampowered.com/ISteamApps/GetAppList/v0001/  which is our base
with open('C:\\Users\\Admin\\Documents\\GitHub\\GamesGraph\\scripts\\wip_data\\_all_appids.json', 
          'r', encoding='utf8') as f:
    steam_json = json.loads(f.read())

steam_list = []

for app in steam_json['applist']['apps']['app']:
    steam_list.append(int(app['appid']))

# appids from all the users we've scrapped
# let's see if there are any that were not given in the first place

scraped_list = []

with open('C:\\Users\\Admin\\Documents\\GitHub\\GamesGraph\\scripts\\wip_data\\_dataframe_merged.csv', 'r') as f:
    for line in f.readlines():
        line = line.replace(',profile,time','')
        line = line.strip('\n')
        line = line.split(',appid')
        for appid in line:
            if len(appid)>0:
                scraped_list.append(int(appid))
        break # just need the first line

warning = [] 

for i in scraped_list:
    if i not in steam_list:
        warning.append(i)
        
print('warning len:',len(warning),warning)


warning len: 0 []

In [36]:
# test for flukes and redirects

import json
with open('C:\\Users\\Admin\\Documents\\GitHub\\GamesGraph\\scripts\\wip_data\\_appids_scraped.json', 
          'r', encoding='utf8') as f:
    j = json.loads(f.read())

redirects = {}    

for app in j:
    if app['appid'] != app['requested_appid']:
        #if app['appid'] == str(515850):
        #    print('appid:',app['appid'],'req_appid',app['requested_appid'],'title',app['title'])
        if app['appid'] in list(redirects.keys()):
            redirects[app['appid']] += 1
        else:
            redirects[app['appid']] = 1
            
#sorted(redirects.items(), key=lambda x: x[1], reverse=True)

# let's check if any of these redirect to another redirect // WE'RE GOOD

redirects = {}

for app in j:
    if app['appid'] != app['requested_appid']:
        try:
            redirects[int(app['requested_appid'])] = int(app['appid'])
        except ValueError:
            pass
print(len(redirects))
for end in list(redirects.values()):
    if end in list(redirects.keys()):
        print('warning!',end)
        
with open('C:\\Users\\Admin\\Documents\\GitHub\\GamesGraph\\scripts\\wip_data\\_redirects_from_to.json', 'w') as f:
    f.write(json.dumps(redirects))


4717

In [53]:
import json
item={
    'id': 12455,
    't':'asdfsdfxcasg2sSS',
    'pos':[432.234,123.235,125.64],
    'c':'A1A1A1',
    's':0.546,
    #'tags':[1,4,78,2],
    #'devs':[1,2],
    #'pubs':[1],
    #'var':{'1':1,'2':2}
     }
list = []
while True:
    list.append(item)
    if len(list)>10000:
        break

with open('C:\\Users\\Admin\\Documents\\GitHub\\GamesGraph\\scripts\\wip_data\\_test_size.json', 
          'w') as f:
    f.write(json.dumps(list))

In [ ]: