econ-ark / HARK

Heterogenous Agents Resources & toolKit
Apache License 2.0
328 stars 197 forks source link

export history to pandas dataframe #837

Open sbenthall opened 3 years ago

sbenthall commented 3 years ago

After a simulation, the user can get the tracked variables through the agent.history property.

This history is a dictionary, where keys are tracked variables and values are a T x N array, where N is the number of agents (AgentCount) and T is the number of periods in the simulation.

I'd like to have the feature of easily exporting this into a Pandas DataFrame format. It would help with some kinds of analysis.

Do this would require adding Pandas as a dependency.

Mv77 commented 3 years ago

I was looking through issues and wanted to express support for this one.

One feature that I think is important would be to have a way to easily keep track of agent's "identities".

In the current framework, when an agent dies it is replaced with a new agent. When formatting histories as a DataFrame it would be very, very useful to keep track of these changes in "identity": a variable that would allow one to know that some observation is from the third individual in a dynasty and not the second.

This can currently be figured out by the user by looking at when t_age is reset. But it would be nice to have it done automatically.

sbenthall commented 3 years ago

Great point. I see this as related to #847 now.

sbenthall commented 3 years ago

See if Dolo has this functionality already for reporting.