diff --git a/README.md b/README.md index 8897de8..ac3a8f2 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 @@ -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 diff --git a/pymort/__init__.py b/pymort/__init__.py index 25cd0f4..3a9fc71 100644 --- a/pymort/__init__.py +++ b/pymort/__init__.py @@ -1,3 +1,3 @@ -__version__ = "1.0.0" +__version__ = "2.0.0" from .XML import MortXML as MortXML diff --git a/tests/test_pymort.py b/tests/test_pymort.py index f236c13..0299a35 100644 --- a/tests/test_pymort.py +++ b/tests/test_pymort.py @@ -2,4 +2,4 @@ def test_version(): - assert __version__ == "1.0.0" + assert __version__ == "2.0.0"