Age Time Grid¶
-
class
cascade_at.model.age_time_grid.
AgeTimeGrid
(ages, times, columns)[source]¶ Bases:
object
The AgeTime grid holds rows of a table at each age and time value.
At each age and time point is a DataFrame consisting of the columns given in the constructor. So getting an item returns a dataframe with those columns. Setting a DataFrame sets those columns. Each AgeTimeGrid has three possible mulstds, for value, dage, dtime.
>>> atg = AgeTimeGrid([0, 10, 20], [1990, 2000, 2010], ["height", "weight"]) >>> atg[:, :] = [6.1, 195] >>> atg[:, :].height = [5.9] >>> atg[10, 2000] = [5.7, 180] >>> atg[5:17, 1980:1990].weight = 125 >>> assert (atg[20, 2000].weight == 195).all() >>> assert isinstance(atg[0, 1990], pd.DataFrame)
If the column has the same name as a function (mean), then access it with getitem,
>>> atg[:, :]["mean"] = [5.9]
Why is this in Pandas, when it’s a regular array of data with an index, which makes it better suited to XArray, or even a Numpy array? It needs to interface with a database representation, and Pandas is a better match there.
-
property
mulstd
¶
-
property