Пример #1
0
def get_bstars(bid):
    sql = 'SELECT stars FROM ortho.business WHERE id='+str(bid)+';' 
    print "SQL = ",sql
    rows = ka.query_SQL(sql)# extracts unique yelp_ids
    bstars = np.array(rows)[0]
    print type(bstars[0])
    print bstars[0]
    return bstars[0]
Пример #2
0
def get_bid(yelp_id):
    #select id from ortho.business where yelp_id="pang-donald-md-fremont";
    sql = 'SELECT id FROM ortho.business WHERE yelp_id='+'"'+yelp_id+'"'+';' 
    print yelp_id
    print "SQL = ",sql
    rows = ka.query_SQL(sql)# extracts unique yelp_ids
    new_bid = np.array(rows)[0]
    print type(new_bid[0])
    return new_bid[0]
Пример #3
0
def get_rstars():
    sql = 'SELECT id, business_id, stars FROM ortho.review;' 
    rows = ka.query_SQL(sql)# extracts unique yelp_ids
    df = pd.DataFrame(np.array(rows),columns=['RID','BID','rstars'])
    return df