Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.8%) to scientific vocabulary
Keywords
Repository
Basic Info
- Host: GitHub
- Owner: actuarialopensource
- Language: Jupyter Notebook
- Default Branch: main
- Size: 75.4 MB
Statistics
- Stars: 13
- Watchers: 2
- Forks: 3
- Open Issues: 0
- Releases: 1
Topics
Metadata Files
README.md
pymort
pymort is a way to retrieve the mortality tables hosted at https://mort.soa.org/. It only hosts the data, an example of a package implementing Lee-Carter models is here - https://github.com/jkoestner/morai/tree/main
Installation
Install pymort with pip install pymort.
MortXML
If you want the full details of any SOA table, you can use the lower level load API. You just need to enter the table ID.
```py from pymort import MortXML
load the 2017 Loaded CSO Composite Gender-Blended 20% Male ALB table (tableId = 3282)
xml = MortXML.from_id(3282)
you can load from a file path on your computer
xmlfrompath = MortXML.from_path("t3282.xml")
you can load from raw xml text
xmlstr = Path("t3282.xml").readtext() xmlfromstr = MortXML(xml_str) ```
This MortXML class is a wrapper around the underlying XML. The autocompletions you get on attributes improve the developer experience over using the underlying XML directly.

Also, mortality rate tables are Pandas DataFrames.

Accessing mortality rates
For a select and ultimate table we can retrieve rates as follows.
```py from pymort import MortXML
Table 3265 is 2015 VBT Smoker Distinct Male Non-Smoker ANB, see https://mort.soa.org/
xml = MortXML.from_id(3265)
This is the select table as a MultiIndex (age/duration) DataFrame.
xml.Tables[0].Values
This is the minimum value of the issue age axis on the select table
xml.Tables[0].MetaData.AxisDefs[0].MinScaleValue
This is the ultimate table as a DataFrame with index attained age.
xml.Tables[1].Values ```
Usage with tensor libraries
We can get the data from Pandas to NumPy.
```py select = MortXML.fromid(3265).Tables[0].Values.unstack().values ultimate = MortXML.fromid(3265).Tables[1].Values.unstack().values
select.shape # (78, 25) ages from 18 to 95, duration from 1 to 25 ultimate.shape # (103,) is age 18 to 120
Be careful when indexing into these, ultimate[0] is the rate at age 18!
```
Owner
- Name: Actuarial Open Source Community
- Login: actuarialopensource
- Kind: organization
- Email: support@actuarialopensource.org
- Location: United States of America
- Website: https://www.actuarialopensource.org/
- Repositories: 25
- Profile: https://github.com/actuarialopensource
Open-source community for actuaries. Join the LinkedIn group to be a memeber.
GitHub Events
Total
Last Year
Dependencies
- abatilo/actions-poetry v2 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- codecov/codecov-action v3 composite
- appnope 0.1.4
- asttokens 2.4.1
- atomicwrites 1.4.1
- attrs 23.2.0
- cffi 1.16.0
- colorama 0.4.6
- comm 0.2.2
- coverage 7.4.4
- debugpy 1.8.1
- decorator 5.1.1
- exceptiongroup 1.2.0
- executing 2.0.1
- importlib-metadata 7.1.0
- ipykernel 6.29.3
- ipython 8.18.1
- jedi 0.19.1
- jupyter-client 8.6.1
- jupyter-core 5.7.2
- matplotlib-inline 0.1.6
- more-itertools 10.2.0
- nest-asyncio 1.6.0
- numpy 1.26.4
- packaging 24.0
- pandas 2.2.1
- parso 0.8.3
- pexpect 4.9.0
- platformdirs 4.2.0
- pluggy 0.13.1
- prompt-toolkit 3.0.43
- psutil 5.9.8
- ptyprocess 0.7.0
- pure-eval 0.2.2
- py 1.11.0
- pycparser 2.21
- pygments 2.17.2
- pytest 5.4.3
- pytest-cov 4.1.0
- python-dateutil 2.9.0.post0
- pytz 2024.1
- pywin32 306
- pyzmq 25.1.2
- six 1.16.0
- stack-data 0.6.3
- tomli 2.0.1
- tornado 6.4
- traitlets 5.14.2
- typing-extensions 4.10.0
- tzdata 2024.1
- wcwidth 0.2.13
- zipp 3.18.1
- ipykernel ^6.4.1 develop
- pytest ^5.2 develop
- pytest-cov ^4.0.0 develop
- pandas >=1.3.4
- python >=3.9,<4.0