## reserving.schedule_p()


Triangles of the CAS loss reserve database (NAIC Schedule P), one


Usage

``` python
reserving.schedule_p(
    line,
    company=None,
    columns=None,
    *,
    accident_years=(1988, 1997),
    lower=False
)
```


segment per company, from the `cas-schedule-p` package.

The package bundles the CAS Schedule P data model's table `mart_reserving_model_training` (no network access); this reads it as `validation/scripts/calibration_panel.py` does for the calibration study: `paid` is `cum_paid_loss`, `incurred` is `incurred_loss` (bulk and IBNR included), `case_incurred` is `incurred_loss - bulk_loss` (Meyers' incurred), [premium](pricing.Price.md#prospicio.pricing.Price.premium) is `earned_prem_net` and `premium_direct` is `earned_prem_direct`, in USD thousands. Ages are `development_age * 12` months. A company's cells are as the mart holds them, so a company with gaps has holes.


## Parameters


`line: str`  
`"ca"` (commercial auto), `"pa"` (private passenger auto), `"wc"` (workers' compensation), `"ol"` (other liability), `"pl"` (products liability) or `"mm"` (medical malpractice), or the CAS file names (`"comauto"`, `"ppauto"`, `"wkcomp"`, `"othliab"`, `"prodliab"`, `"medmal"`) or the mart's names (`"commercial_auto"`, …).

`company: (int, str or list) = None`  
NAIC group or company codes (`353` or `"353"`); every company in the line by default.

`columns: str or list of str = None`  
Measures among `"paid"`, `"incurred"`, `"case_incurred"`, `"premium"` and `"premium_direct"`; all five by default.

`accident_years: (int, int) = (1988, 1997)`  
The first and last accident year. The mart's accident years run to 2007; Meyers' panel uses 1988 to 1997.

`lower: bool = ``False`  
Whether to keep the cells valued after the last accident year's first year-end: the lower triangle, which a study holds out as the outcome. With it, each complete company is a 10 x 10 square.


## Returns


`Triangle`  
Keyed by `company` (the code as a string), with annual origins and development, cumulative.


## Raises


`ImportError`  
If `cas-schedule-p` or `pyarrow` is not installed.

`ValueError`  
For an unknown line or column, or a company with no rows in the line and years.


## Examples

``` python
>>> from prospicio.reserving import schedule_p
>>> tri = schedule_p("ca", company=353, columns=["paid", "premium"])  # doctest: +SKIP
>>> tri.index, tri.shape  # doctest: +SKIP
```

(\['353'\], (1, 2, 10, 10))
