Beispiel #1
0
'''
Created on Dec 1, 2012

@author: cosmin
'''

from foa import Foa

# Load data
foa = Foa()
users = foa.load_users_from_csv("../data/users.csv")
projects = foa.loadProjectDetailsFromCSV("../data/projects_details.csv")

# Processing the projects
print "Building nationalities interactions map..."
countries = {}
count = 0
no_accepted = 0
failed = 0
for p in projects.values():
    # Printing
    count += 1
    if count % 2500 == 0:
        print "Processed", count, "projects out of", len(projects.values())

    # Get the countries of accepted bidders for this buyer_country
    accepted = countries.get(p.buyer_country)
    if accepted == None:
        accepted = [0, {}]
        countries[p.buyer_country] = accepted
Beispiel #2
0
           
    patterns = patterns.items()
    patterns.sort(key = lambda tup:tup[1][1], reverse = True)
    fout = open("earnings_by_pattern.dict", "w")
    #print patterns
    for pattern in patterns:
        #pattern avg_bid max_bid
        fout.write("%s:%f:%f,\n"%(pattern[0], pattern[1][0]/pattern[1][2], pattern[1][1]))
    fout.close()

'''
luam project details: jobs, currency, accepted bidder id
luam bidders: accepted bidder id - bid amount
bid amount * currecy ptr pattern de joburi
'''
foa = Foa()
details = foa.loadProjectDetailsFromCSV(filename="full_projects_details.csv")
fin = open("projects_bids_uniq.csv", "r")
bids = {}
count = 0
for line in fin.readlines():
    print count
    count += 1
    bid = line.split(", ")
    prj_id = int(bid[0])
    #print "PRJ ",
    #print type(prj_id),
    #print "DETAL ",
    #print type(details.keys()[0])
    if(prj_id in details):
        project = details[prj_id]
"""
Created on Dec 1, 2012

@author: cosmin
"""

from foa import Foa

# Load data
foa = Foa()
users = foa.load_users_from_csv("../data/users.csv")
projects = foa.loadProjectDetailsFromCSV("../data/projects_details.csv")

# Processing the projects
print "Building nationalities interactions map..."
countries = {}
count = 0
no_accepted = 0
failed = 0
for p in projects.values():
    # Printing
    count += 1
    if count % 2500 == 0:
        print "Processed", count, "projects out of", len(projects.values())

    # Get the countries of accepted bidders for this buyer_country
    accepted = countries.get(p.buyer_country)
    if accepted == None:
        accepted = [0, {}]
        countries[p.buyer_country] = accepted