Add support for polars
Currently, lifelines only supports pandas for its operations. It would be great if there was polars support. It might be interesting to look into narwhals which allows projects to support multiple backends, i.e. pandas and polars.
@pavelzw I'm working on implementing aj estimates (nonparametric estimation as km / cif) supported by polars. It might be helpful to you?
We are using KaplerMeierFilter and CoxPHFitter from lifelines. If those had the option of outputting polars instead of pandas, that would be great
I can help you out with KM, but Cox regression is a semi-parametric method and that might be trickier to implement.
I would be happy to contribute to this by modifying the CTV fitter. The main reason being the run time to fit the model is far too slow due to pandas and not polars being used.
I'm not familiar with the source, but I believe if the library moves some functions to polars this should be done for all functions. Although this would require polars for all users. Any maintainers got thoughts on this?
I happy to submit a PR but im not going to waste my time if there are other considerations already being made, polars is not the only option for large dataframe processing, duckdb would be even faster.
i think to be able to support both polars and pandas, it would be nice to look a bit into narwhals. the syntax is very modern polars-like but under the hood can get translated to pandas if people use pandas.
I agree I think this is a good idea, this will however require a major code refactoring and I'm not doing that unless I can see any interest from one of the main maintainers. Thoughts @CamDavidsonPilon ?