📜  thanatologue (1)

📅  最后修改于: 2023-12-03 15:05:35.251000             🧑  作者: Mango

Thanatologue

Thanatologue is a Python package that provides a class for working with mortality data. The name comes from "thanatos," the Greek term for death, and "logos," which means study or discourse.

Features
  • Load mortality data from different sources and formats (e.g., Excel, CSV, SPSS)
  • Clean and preprocess the data (e.g., remove duplicates, handle missing values)
  • Calculate mortality indicators (e.g., age-specific death rates, life expectancy)
  • Estimate and forecast mortality rates using different methods (e.g., Lee-Carter, Cairns-Blake-Dowd)
  • Build life tables and calculate associated measures (e.g., probability of dying, number of survivors)
Installation

To install Thanatologue, you can use pip:

pip install thanatologue
Usage

Here's an example of how to use Thanatologue to load and preprocess mortality data:

from thanatologue import MortalityData

data = MortalityData.from_csv('mort_data.csv')
data.clean_data()

And here's an example of how to calculate age-specific death rates and life expectancy:

death_rates = data.get_death_rates()
life_expectancy = data.get_life_expectancy()

You can also estimate mortality models and forecast future mortality rates:

from thanatologue import MortalityModel

model = MortalityModel.fit(data, method='lee-carter')
forecast = model.forecast(n=10)

Finally, you can build life tables and calculate associated measures:

from thanatologue import LifeTable

table = LifeTable(data)
table.build()
prob_die = table.get_probability_of_dying()
num_survivors = table.get_number_of_survivors(75)
Documentation

The full documentation for Thanatologue is available at https://thanatologue.readthedocs.io/en/latest/.

License

Thanatologue is released under the MIT License.