RaphaelS1 / survivalmodels

Implementations of survival models in R
https://raphaels1.github.io/survivalmodels/
Other
57 stars 13 forks source link

Error in coxtime function #40

Closed jensrobben closed 1 year ago

jensrobben commented 1 year ago

When running the 'coxtime' function in R, I always get an error saying

_Error in py_callimpl(callable, dots$args, dots$keywords) : AttributeError: 'Series' object has no attribute 'iteritems'

For example, the error pops up in the example code of the function as well: > coxtime(data = simsurvdata(50)) Is there possibly something wrong within the function?

Thanks in advance!

RaphaelS1 commented 1 year ago

Hey thanks for opening the issue, can you use the reprex package so I can see a reproducible example? And please include session info

jensrobben commented 1 year ago

`> sessionInfo() R version 4.2.3 (2023-03-15 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale: [1] LC_COLLATE=Dutch_Belgium.utf8 LC_CTYPE=Dutch_Belgium.utf8 LC_MONETARY=Dutch_Belgium.utf8 [4] LC_NUMERIC=C LC_TIME=Dutch_Belgium.utf8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] mlr3extralearners_0.6.1-9000 survivalmodels_0.1.13 mlr3tuning_0.18.0.9000
[4] paradox_0.11.1 mlr3proba_0.5.2 mlr3_0.15.0
[7] mlr3pipelines_0.4.3 mlr3benchmark_0.1.5-9000 ggplot2_3.4.2

loaded via a namespace (and not attached): [1] reticulate_1.28 distr6_1.6.15 tidyselect_1.2.0 purrr_1.0.1
[5] listenv_0.9.0 splines_4.2.3 lattice_0.20-45 colorspace_2.1-0
[9] vctrs_0.6.1 generics_0.1.3 bbotk_0.7.2 dictionar6_0.1.3
[13] utf8_1.2.3 survival_3.5-3 rlang_1.1.0 pillar_1.9.0
[17] glue_1.6.2 withr_2.5.0 param6_0.2.4 palmerpenguins_0.1.1 [21] uuid_1.1-0 lifecycle_1.0.3 munsell_0.5.0 gtable_0.3.3
[25] future_1.32.0 mvtnorm_1.1-3 codetools_0.2-19 EnvStats_2.7.0
[29] parallel_4.2.3 fansi_1.0.4 DEoptimR_1.0-12 Rcpp_1.0.10
[33] backports_1.4.1 scales_1.2.1 checkmate_2.1.0 mlr3viz_0.6.1.9000
[37] jsonlite_1.8.4 parallelly_1.35.0 png_0.1-8 digest_0.6.31
[41] dplyr_1.1.1 rprojroot_2.0.3 grid_4.2.3 here_1.0.1
[45] cli_3.6.1 tools_4.2.3 magrittr_2.0.3 tibble_3.2.1
[49] mlr3misc_0.11.0 crayon_1.5.2 tidyr_1.3.0 pkgconfig_2.0.3
[53] Matrix_1.5-3 data.table_1.14.8 ooplah_0.2.0 rstudioapi_0.14
[57] lgr_0.4.4 R6_2.5.1 globals_0.16.2 set6_0.2.5
[61] compiler_4.2.3`

Weird enough, I don't get the same error when running in using the reprex package.

RaphaelS1 commented 1 year ago

Probably indicates something about your environment and not an error in the package then. Will close the issue for now but please reopen if you think there's a bug in the software. You might want to try reinstalling reticulate/miniconda

jensrobben commented 1 year ago

Is it possible it has something to do with the new version of the Python package 'pandas', version 2.0.0 has been released in the beginning of April? I read it doesn't support anymore the function 'iteritems' possibly? The function 'coxtime' in Python uses 'iteritems'

RaphaelS1 commented 1 year ago

Possibly - from the CI runner it looks like the bug might be in the underlying pycox implementation. You might have to selectively install a different pandas version