DimensionError#

exception cultivars.exceptions.DimensionError[source]#

Bases: CultivarsError, ValueError

An array has the wrong shape, rank, or is non-conformable.

The input was understood but its geometry does not fit: a series where a panel was expected, a coefficient block whose trailing shape disagrees with the state dimension, two series of different lengths handed to a bivariate test. Also a ValueError, so code that already catches that keeps working. Raised almost entirely by the shape validators in _core (validate_endog, validate_endog_matrix, validate_aligned, validate_panel) before any model logic runs.

See also

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR
>>> VAR(np.zeros((50, 2, 2)), order=1)
Traceback (most recent call last):
    ...
cultivars.exceptions.DimensionError: endog must be two-dimensional (nobs, k); got a ...
>>> try:
...     VAR(np.zeros((50, 2, 2)), order=1)
... except ValueError as error:
...     print(isinstance(error, CultivarsError))
True