Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

survival_table_from_events intervals outside of maximum causes error #1587

Closed
swit22 opened this issue Dec 19, 2023 · 0 comments
Closed

survival_table_from_events intervals outside of maximum causes error #1587

swit22 opened this issue Dec 19, 2023 · 0 comments

Comments

@swit22
Copy link

swit22 commented Dec 19, 2023

When using collapse = True and intervals in lifelines.utils.survival_table_from_events, a 'Cannot convert non-finite values (NA or inf) to integer' ValueError is thrown when any of the intervals exceed the maximum time of the observations. This makes it difficult to use uniform intervals for multiple populations. I'm also seeing this error happen occasionally even when the intervals don't exceed the bounds of the observations.
I'm aiming to use the survival_table_from_events to get a table with one row per year up to a set year, where values are zero beyond the maximum year of the population.
Using lifelines version 0.27.7
from lifelines.datasets import load_waltons
from lifelines.utils import survival_table_from_events
import numpy as np
waltons = load_waltons()
survival_table_from_events(waltons['T'], waltons['E'], collapse = True, intervals = np.arange(10,100).tolist())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant