-
Notifications
You must be signed in to change notification settings - Fork 926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to import external data and define as model attributes at each step? #201
Comments
We don't have that functionality built in yet (though it would be a nice thing to have). Looking at your code, it looks like you're missing a couple
I can't test your code without the data, but that might be enough to solve the problem. Two more quick suggestions: If you're working with tabular data, you may also want to look at the pandas library, which lets you load data into an R-style data frame. And for future code uploading, you may want to check out the GitHub gist feature, which lets you quickly copy-paste files to upload them for sharing. Hope that helps! |
Thanks David. I have added the prefix to each function now. However, the data still cannot be read. Here is how I test the data import now: It turns out that the output chart is still a line at 0. Since I went through the code so many times, it is hard to tell where is the problem. Is it possible for you to run the test and see what's wrong with it? I have uploaded several lines of the external data. Thanks! |
One other bug is that you aren't actually adding agents to the schedule, so when you run the model, no agents are actually running. That section of the init method should be:
The rest seems pretty specific to your model, so I'll shoot you an email about it. |
I think this has been resolved. |
Replace shuffle().do() in 18 models with the performance optimized shuffle_do() method.
Replace shuffle().do() in 18 models with the performance optimized shuffle_do() method.
Replace shuffle().do() in 18 models with the performance optimized shuffle_do() method.
Replace shuffle().do() in 18 models with the performance optimized shuffle_do() method.
Thanks for developing this great ABM framework in Python. I am trying to transfer my model from NetLogo to Mesa. It is a model that simulates trading in stock market. I have historical stock prices and other information as input (model level attributes), and based on the information, calculate some derived model level attributes. Each step after the model level attributes are imported and calculated, then each agent start trading according to the model level attributes and its own preference.
To start with, I only tried to import model level information and computed one of the derived attributes. I used data collector and chart visualization to check if my codes worked. However, it seemed that I did not import the data successfully. So my question for now is that how to import external data and define as model attributes? I also upload my code here. Thanks.
bac_model1.txt
The text was updated successfully, but these errors were encountered: