gEconpy.model.model.matrix_to_dataframe#

gEconpy.model.model.matrix_to_dataframe(matrix, model, dim1=None, dim2=None, round=None)#

Convert a matrix to a DataFrame with variable names as columns and rows.

Parameters:
matrix: np.ndarray

DSGE matrix to convert to a DataFrame. Each dimension should have shape n_variables or n_shocks.

model: Model

DSGE model object

dim1: str, Optional

Name of the first dimension of the matrix. Must be one of “variable”, “equation”, or “shock”. If None, the function will guess based on the shape of the matrix. In the event that the model has exactly as many variables as shocks, it will guess “variable”, so be careful!

dim2: str, Optional

Name of the second dimension of the matrix. Must be one of “variable”, “equation”, or “shock”. If None, the function will guess based on the shape of the matrix.

round: int, Optional

Number of decimal places to round the values in the DataFrame. If None, values will not be rounded.

Returns:
pd.DataFrame

DataFrame with variable names as columns and rows.