Skip to content

Commit

Permalink
bump readme, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewCaseres committed Mar 23, 2024
1 parent 727d14a commit 3f6be93
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ If you want the full details of **any** SOA table, you can use the lower level `
```py
from pymort import MortXML
# load the 2017 Loaded CSO Composite Gender-Blended 20% Male ALB table (tableId = 3282)
xml = MortXML(3282)
xml = MortXML.from_id(3282)
# you can load from a file path on your computer
xml_from_path = MortXML.from_path("t3282.xml")
# you can load from raw xml text
xml_str = Path("t3282.xml").read_text()
xml_from_str = MortXML(xml_str)
```

This `MortXML` class is a wrapper around the [underlying XML](https://mort.soa.org/About.aspx). The autocompletions you get on attributes improve the developer experience over using the underlying XML directly.
Expand All @@ -34,7 +39,7 @@ 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(3265)
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
Expand All @@ -48,8 +53,8 @@ xml.Tables[1].Values
We can get the data from Pandas to NumPy.

```py
select = MortXML(3265).Tables[0].Values.unstack().values
ultimate = MortXML(3265).Tables[1].Values.unstack().values
select = MortXML.from_id(3265).Tables[0].Values.unstack().values
ultimate = MortXML.from_id(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
Expand Down
2 changes: 1 addition & 1 deletion pymort/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "1.0.0"
__version__ = "2.0.0"

from .XML import MortXML as MortXML
2 changes: 1 addition & 1 deletion tests/test_pymort.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_version():
assert __version__ == "1.0.0"
assert __version__ == "2.0.0"

0 comments on commit 3f6be93

Please sign in to comment.