Closed juliazhang95 closed 3 years ago
Dear Julia, we have fixed this bug. Please run pip install abce --upgrade
Yes, the bug is no longer in master. I ran a slightly modified version of the code above, and encountered no problem
import random
import abcEconomics as abce
# Define all agents in the economy
class Citizen(abce.Agent):
def init(self, money):
# initial money balance
self.create('money', money)
# years of schooling
self.employee_qualification = random.randint(0, 21)
def get_salary(self):
return 100
simulation = abce.Simulation(name='economy', processes=1)
citizens = simulation.build_agents(Citizen, 'citizen', number=10, money = 1000)
print(citizens[0].get_salary())
In the documentation, it says that individual agents in a group can be accessed with an index. When I tried this, it gave me a TypeError
Code used:
Error:
Please let me know if I am attempting to access the agents incorrectly, or doing something wrong!