ExposedDF.from_DataFrame
expose.ExposedDF.from_DataFrame(data, end_date, start_date=date(1900, 1, 1), target_status=None, cal_expo=False, expo_length='year', trx_types=None, col_pol_num='pol_num', col_status='status', col_exposure='exposure', col_pol_per=None, cols_dates=None, col_trx_n_='trx_n_', col_trx_amt_='trx_amt_', default_status=None)
Coerce a data frame to an ExposedDF
object
The input data frame must have columns for policy numbers, statuses, exposures, policy periods (for policy exposures only), and exposure start / end dates. Optionally, if data
has transaction counts and amounts by type, these can be specified without calling add_transactions()
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
data |
polars.polars.DataFrame | pandas.pandas.DataFrame | A data frame with exposure-level records | required |
end_date |
datetime.date | str | Experience study end date | required |
start_date |
datetime.date | str | Experience study start date | date(1900, 1, 1) |
target_status |
str | list | numpy.numpy.ndarray | Target status values | None |
cal_expo |
bool | Set to True for calendar year exposures. Otherwise policy year exposures are assumed. |
False |
expo_length |
str | Exposure period length. Must be ‘year’, ‘quarter’, ‘month’, or ‘week’ | 'year' |
trx_types |
list | str | List containing unique transaction types that have been attached to data . For each value in trx_types , from_DataFrame requires that columns exist in data named trx_n_{*} and trx_amt_{*} containing transaction counts and amounts, respectively. The prefixes “trx_n_” and “trx_amt_” can be overridden using the col_trx_n_ and col_trx_amt_ arguments. |
None |
col_pol_num |
str | Name of the column in data containing the policy number |
'pol_num' |
col_status |
str | name of the column in data containing the policy status |
'status' |
col_exposure |
str | Name of the column in data containing exposures. |
'exposure' |
col_pol_per |
str | Name of the column in data containing policy exposure periods. Only necessary if cal_expo is False . The assumed default is either “pol_yr”, “pol_qtr”, “pol_mth”, or “pol_wk” depending on the value of expo_length . |
None |
cols_dates |
str | Names of the columns in data containing exposure start and end dates. Both date ranges are assumed to be exclusive. The assumed default is of the form A_B. A is “cal” if cal_expo is True or “pol” otherwise. B is either “yr”, “qtr”, “mth”, or “wk” depending on the value of expo_length . |
None |
col_trx_n_ |
str | Prefix to use for columns containing transaction counts. | "trx_n_" |
col_trx_amt_ |
str | Prefix to use for columns containing transaction amounts. | "trx_amt_" |
default_status |
str | Default active status code | None |
Returns
Type | Description |
---|---|
actxps.expose.ExposedDF | An ExposedDF object. |