-
Notifications
You must be signed in to change notification settings - Fork 193
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
AttributeError: 'Series' object has no attribute 'is_monotonic' #162
Comments
Same issue here. Looks like that function has been removed from pandas? |
Yes, in the new version of Pandas, use “is_ monotonic_ incrementing” instead of "is_ monotonic"
谢灿
***@***.***
…------------------ 原始邮件 ------------------
发件人: "Kez ***@***.***>;
发送时间: 2023年5月19日(星期五) 晚上10:10
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Same issue here. Looks like that function has been removed from pandas?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Have you found a way to use a Are there plans to update the |
Yes, I have to change it manually to make it works. Further, maybe a version restriction should be added in the setup.py . |
thank you, dude
谢灿
***@***.***
…------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2023年7月19日(星期三) 下午3:00
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
是的,我必须手动更改它,使其工作。
此外,也许应该在setup.py中添加版本限制。
—
直接回复此邮件,在GitHub上查看,或者取消订阅.
***@***.***与>.
|
I encountered a similar issue when using the pycox class EvalSurv to evaluate the concordance. The error message was "AttributeError: 'Series' object has no attribute 'is_monotonic'. " Can anyone help me solve the problem? Thanks! |
Changed pd.Series.is_monotonic to pd.Series.is_monotonic_increasing for newer versions of pandas.
谢灿
***@***.***
…------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2023年8月29日(星期二) 中午1:20
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
I encountered a similar issue when using the pycox class EvalSurv to evaluate the concordance. The error message was "AttributeError: 'Series' object has no attribute 'is_monotonic'. " Can anyone help me solve the problem? Thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hi Can,
Thank you so much for your reply. I appreciate you taking your valuable time to help me. I followed your instruction by changing the line “assert pd.Series(self.index_surv).is_monotonic” to “assert pd.Series.is_monotonic_increasing” in the eval_surv.py file. However, I still encountered the same error.
The example that I am using is the pycox dataset “metabric”. The pythyon syntax has been posted at this link: https://github.com/havakv/pycox/blob/master/examples/cox-ph.ipynb . I am able to run all lines except “ev = EvalSurv(surv, durations_test, events_test, censor_surv='km')” . I have attached the eval_surv.py file, and would appreciate it very much if you could please review it and advise me.
Thank you, sincerely,
Jane
From: Can Xie ***@***.***>
Sent: Tuesday, August 29, 2023 4:43 AM
To: havakv/pycox ***@***.***>
Cc: Jing Wang ***@***.***>; Comment ***@***.***>
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Changed pd.Series.is_monotonic to pd.Series.is_monotonic_increasing for newer versions of pandas.
谢灿
***@***.***<mailto:***@***.***>
…------------------ 原始邮件 ------------------
发件人: ***@***.***><mailto:***@***.***>>;;
发送时间: 2023年8月29日(星期二) 中午1:20
收件人: ***@***.***><mailto:***@***.***>>;;
抄送: ***@***.***><mailto:***@***.***>>;; ***@***.***><mailto:***@***.***>>;;
主题: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
I encountered a similar issue when using the pycox class EvalSurv to evaluate the concordance. The error message was "AttributeError: 'Series' object has no attribute 'is_monotonic'. " Can anyone help me solve the problem? Thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***><mailto:***@***.***>>;
—
Reply to this email directly, view it on GitHub<#162 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BCGNGDQ7CHWBRU4TWZSWBNDXXXBR7ANCNFSM6AAAAAAXUNTZ4Q>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
Hi Can,
I wanted to let you know that I was just able to run the EvalSurv after upgrading pandas and pycox.
Thanks again for your help!
Jane
From: Jing Wang ***@***.***>
Sent: Tuesday, August 29, 2023 10:30 PM
To: havakv/pycox ***@***.***>; havakv/pycox ***@***.***>
Cc: Comment ***@***.***>
Subject: RE: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Hi Can,
Thank you so much for your reply. I appreciate you taking your valuable time to help me. I followed your instruction by changing the line “assert pd.Series(self.index_surv).is_monotonic” to “assert pd.Series.is_monotonic_increasing” in the eval_surv.py file. However, I still encountered the same error.
The example that I am using is the pycox dataset “metabric”. The pythyon syntax has been posted at this link: https://github.com/havakv/pycox/blob/master/examples/cox-ph.ipynb . I am able to run all lines except “ev = EvalSurv(surv, durations_test, events_test, censor_surv='km')” . I have attached the eval_surv.py file, and would appreciate it very much if you could please review it and advise me.
Thank you, sincerely,
Jane
From: Can Xie ***@***.******@***.***>>
Sent: Tuesday, August 29, 2023 4:43 AM
To: havakv/pycox ***@***.******@***.***>>
Cc: Jing Wang ***@***.******@***.***>>; Comment ***@***.******@***.***>>
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Changed pd.Series.is_monotonic to pd.Series.is_monotonic_increasing for newer versions of pandas.
谢灿
***@***.***<mailto:***@***.***>
…------------------ 原始邮件 ------------------
发件人: ***@***.***><mailto:***@***.***>>;;
发送时间: 2023年8月29日(星期二) 中午1:20
收件人: ***@***.***><mailto:***@***.***>>;;
抄送: ***@***.***><mailto:***@***.***>>;; ***@***.***><mailto:***@***.***>>;;
主题: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
I encountered a similar issue when using the pycox class EvalSurv to evaluate the concordance. The error message was "AttributeError: 'Series' object has no attribute 'is_monotonic'. " Can anyone help me solve the problem? Thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***><mailto:***@***.***>>;
—
Reply to this email directly, view it on GitHub<#162 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BCGNGDQ7CHWBRU4TWZSWBNDXXXBR7ANCNFSM6AAAAAAXUNTZ4Q>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
Sorry, Jane. I haven't used Pycox for half a year, but I vaguely remember a modification in an official SDK location. Please take a look at the error information and I'll give you a screenshot for reference,that may help you.
…---Original---
From: ***@***.***>
Date: Wed, Aug 30, 2023 12:44 PM
To: ***@***.***>;
Cc: "Can ***@***.******@***.***>;
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute'is_monotonic' (Issue #162)
Hi Can,
I wanted to let you know that I was just able to run the EvalSurv after upgrading pandas and pycox.
Thanks again for your help!
Jane
From: Jing Wang ***@***.***>
Sent: Tuesday, August 29, 2023 10:30 PM
To: havakv/pycox ***@***.***>; havakv/pycox ***@***.***>
Cc: Comment ***@***.***>
Subject: RE: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Hi Can,
Thank you so much for your reply. I appreciate you taking your valuable time to help me. I followed your instruction by changing the line “assert pd.Series(self.index_surv).is_monotonic” to “assert pd.Series.is_monotonic_increasing” in the eval_surv.py file. However, I still encountered the same error.
The example that I am using is the pycox dataset “metabric”. The pythyon syntax has been posted at this link: https://github.com/havakv/pycox/blob/master/examples/cox-ph.ipynb . I am able to run all lines except “ev = EvalSurv(surv, durations_test, events_test, censor_surv='km')” . I have attached the eval_surv.py file, and would appreciate it very much if you could please review it and advise me.
Thank you, sincerely,
Jane
From: Can Xie ***@***.******@***.***>>
Sent: Tuesday, August 29, 2023 4:43 AM
To: havakv/pycox ***@***.******@***.***>>
Cc: Jing Wang ***@***.******@***.***>>; Comment ***@***.******@***.***>>
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Changed&nbsp;pd.Series.is_monotonic&nbsp;to&nbsp;pd.Series.is_monotonic_increasing&nbsp;for newer versions of pandas.
&nbsp;
谢灿
***@***.***<mailto:***@***.***>
&nbsp;
------------------&nbsp;原始邮件&nbsp;------------------
发件人: ***@***.***&gt<mailto:***@***.***&gt>;;
发送时间: 2023年8月29日(星期二) 中午1:20
收件人: ***@***.***&gt<mailto:***@***.***&gt>;;
抄送: ***@***.***&gt<mailto:***@***.***&gt>;; ***@***.***&gt<mailto:***@***.***&gt>;;
主题: Re: [havakv/pycox] AttributeError: &#39;Series&#39; object has no attribute &#39;is_monotonic&#39; (Issue #162)
I encountered a similar issue when using the pycox class EvalSurv to evaluate the concordance. The error message was "AttributeError: 'Series' object has no attribute 'is_monotonic'. " Can anyone help me solve the problem? Thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***&gt<mailto:***@***.***&gt>;
—
Reply to this email directly, view it on GitHub<#162 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BCGNGDQ7CHWBRU4TWZSWBNDXXXBR7ANCNFSM6AAAAAAXUNTZ4Q>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
It doesn't seem like this position is correct. You have already made the changes, and I am recalling it😓😓
…---Original---
From: ***@***.***>
Date: Wed, Aug 30, 2023 12:44 PM
To: ***@***.***>;
Cc: "Can ***@***.******@***.***>;
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute'is_monotonic' (Issue #162)
Hi Can,
I wanted to let you know that I was just able to run the EvalSurv after upgrading pandas and pycox.
Thanks again for your help!
Jane
From: Jing Wang ***@***.***>
Sent: Tuesday, August 29, 2023 10:30 PM
To: havakv/pycox ***@***.***>; havakv/pycox ***@***.***>
Cc: Comment ***@***.***>
Subject: RE: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Hi Can,
Thank you so much for your reply. I appreciate you taking your valuable time to help me. I followed your instruction by changing the line “assert pd.Series(self.index_surv).is_monotonic” to “assert pd.Series.is_monotonic_increasing” in the eval_surv.py file. However, I still encountered the same error.
The example that I am using is the pycox dataset “metabric”. The pythyon syntax has been posted at this link: https://github.com/havakv/pycox/blob/master/examples/cox-ph.ipynb . I am able to run all lines except “ev = EvalSurv(surv, durations_test, events_test, censor_surv='km')” . I have attached the eval_surv.py file, and would appreciate it very much if you could please review it and advise me.
Thank you, sincerely,
Jane
From: Can Xie ***@***.******@***.***>>
Sent: Tuesday, August 29, 2023 4:43 AM
To: havakv/pycox ***@***.******@***.***>>
Cc: Jing Wang ***@***.******@***.***>>; Comment ***@***.******@***.***>>
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Changed&nbsp;pd.Series.is_monotonic&nbsp;to&nbsp;pd.Series.is_monotonic_increasing&nbsp;for newer versions of pandas.
&nbsp;
谢灿
***@***.***<mailto:***@***.***>
&nbsp;
------------------&nbsp;原始邮件&nbsp;------------------
发件人: ***@***.***&gt<mailto:***@***.***&gt>;;
发送时间: 2023年8月29日(星期二) 中午1:20
收件人: ***@***.***&gt<mailto:***@***.***&gt>;;
抄送: ***@***.***&gt<mailto:***@***.***&gt>;; ***@***.***&gt<mailto:***@***.***&gt>;;
主题: Re: [havakv/pycox] AttributeError: &#39;Series&#39; object has no attribute &#39;is_monotonic&#39; (Issue #162)
I encountered a similar issue when using the pycox class EvalSurv to evaluate the concordance. The error message was "AttributeError: 'Series' object has no attribute 'is_monotonic'. " Can anyone help me solve the problem? Thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***&gt<mailto:***@***.***&gt>;
—
Reply to this email directly, view it on GitHub<#162 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BCGNGDQ7CHWBRU4TWZSWBNDXXXBR7ANCNFSM6AAAAAAXUNTZ4Q>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
No worries, Can. I was able to run the syntax with no error after I made your suggested change in the evaluation file. Thank you for helping me!
Have a great day!
Jane
From: Can Xie ***@***.***>
Sent: Tuesday, August 29, 2023 11:36 PM
To: havakv/pycox ***@***.***>
Cc: Jing Wang ***@***.***>; Comment ***@***.***>
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
It doesn't seem like this position is correct. You have already made the changes, and I am recalling it😓😓
…---Original---
From: ***@***.***><mailto:***@***.***>>;
Date: Wed, Aug 30, 2023 12:44 PM
To: ***@***.***><mailto:***@***.***>>;;
Cc: "Can ***@***.******@***.***><mailto:***@***.******@***.***>>;;
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute'is_monotonic' (Issue #162)
Hi Can,
I wanted to let you know that I was just able to run the EvalSurv after upgrading pandas and pycox.
Thanks again for your help!
Jane
From: Jing Wang ***@***.***><mailto:***@***.***>>;
Sent: Tuesday, August 29, 2023 10:30 PM
To: havakv/pycox ***@***.***><mailto:***@***.***>>;; havakv/pycox ***@***.***><mailto:***@***.***>>;
Cc: Comment ***@***.***><mailto:***@***.***>>;
Subject: RE: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Hi Can,
Thank you so much for your reply. I appreciate you taking your valuable time to help me. I followed your instruction by changing the line “assert pd.Series(self.index_surv).is_monotonic” to “assert pd.Series.is_monotonic_increasing” in the eval_surv.py file. However, I still encountered the same error.
The example that I am using is the pycox dataset “metabric”. The pythyon syntax has been posted at this link: https://github.com/havakv/pycox/blob/master/examples/cox-ph.ipynb . I am able to run all lines except “ev = EvalSurv(surv, durations_test, events_test, censor_surv='km')” . I have attached the eval_surv.py file, and would appreciate it very much if you could please review it and advise me.
Thank you, sincerely,
Jane
From: Can Xie ***@***.******@***.***>><mailto:***@***.******@***.***>>>;
Sent: Tuesday, August 29, 2023 4:43 AM
To: havakv/pycox ***@***.******@***.***>><mailto:***@***.******@***.***>>>;
Cc: Jing Wang ***@***.******@***.***>><mailto:***@***.******@***.***>>>;; Comment ***@***.******@***.***>><mailto:***@***.******@***.***>>>;
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
Changed&nbsp;pd.Series.is_monotonic&nbsp;to&nbsp;pd.Series.is_monotonic_increasing&nbsp;for newer versions of pandas.
&nbsp;
谢灿
***@***.***<mailto:***@***.***><mailto:***@***.***%3cmailto:***@***.***>>;
&nbsp;
------------------&nbsp;原始邮件&nbsp;------------------
发件人: ***@***.***&gt<mailto:***@***.***&gt><mailto:***@***.***&gt%3cmailto:***@***.***&gt>>;;;
发送时间: 2023年8月29日(星期二) 中午1:20
收件人: ***@***.***&gt<mailto:***@***.***&gt><mailto:***@***.***&gt%3cmailto:***@***.***&gt>>;;;
抄送: ***@***.***&gt<mailto:***@***.***&gt><mailto:***@***.***&gt%3cmailto:***@***.***&gt>>;;; ***@***.***&gt<mailto:***@***.***&gt><mailto:***@***.***&gt%3cmailto:***@***.***&gt>>;;;
主题: Re: [havakv/pycox] AttributeError: &#39;Series&#39; object has no attribute &#39;is_monotonic&#39; (Issue #162)
I encountered a similar issue when using the pycox class EvalSurv to evaluate the concordance. The error message was "AttributeError: 'Series' object has no attribute 'is_monotonic'. " Can anyone help me solve the problem? Thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***&gt<mailto:***@***.***&gt><mailto:***@***.***&gt%3cmailto:***@***.***&gt>>;;
—
Reply to this email directly, view it on GitHub<#162 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BCGNGDQ7CHWBRU4TWZSWBNDXXXBR7ANCNFSM6AAAAAAXUNTZ4Q>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
—
Reply to this email directly, view it on GitHub<#162 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BCGNGDURQ6BTQXYRCHSPQ4LXX3GL5ANCNFSM6AAAAAAXUNTZ4Q>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
but I still can't run it after I change all ‘is_monotonic’ into ‘is_monotonic_increasing’ |
I got it to work after upgrading pycox and pandas. Try it. Hope it works for you.
From: xytd20 ***@***.***>
Sent: Wednesday, August 30, 2023 9:45 AM
To: havakv/pycox ***@***.***>
Cc: Jing Wang ***@***.***>; Comment ***@***.***>
Subject: Re: [havakv/pycox] AttributeError: 'Series' object has no attribute 'is_monotonic' (Issue #162)
but I still can't run it after I change all ‘is_monotonic’ into ‘is_monotonic_increasing’
—
Reply to this email directly, view it on GitHub<#162 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BCGNGDQQFGYOAS6EQLNXINLXX5NZTANCNFSM6AAAAAAXUNTZ4Q>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
Could you please elaborate more on this issue? |
to what version of pandas and pycox did u upgrade ? |
36 assert pd.Series(self.index_surv).is_monotonic |
|
Hi, dear Haavard
When I execute this function---- ev=EvalSurv (surv, durations_test, events_test, center_surv='km '), the following error occurs:
AttributeError Traceback (most recent call last)
Cell In[27], line 1
----> 1 ev = EvalSurv(surv, durations_test, events_test, censor_surv='km')
File D:\anaconda3\envs\pytorch\lib\site-packages\pycox\evaluation\eval_surv.py:33, in EvalSurv.init(self, surv, durations, events, censor_surv, censor_durations, steps)
31 self.durations = durations
32 self.events = events
---> 33 self.censor_surv = censor_surv
34 self.censor_durations = censor_durations
35 self.steps = steps
File D:\anaconda3\envs\pytorch\lib\site-packages\pycox\evaluation\eval_surv.py:51, in EvalSurv.censor_surv(self, censor_surv)
49 elif type(censor_surv) is str:
50 if censor_surv == 'km':
---> 51 self.add_km_censor()
52 else:
53 raise ValueError(f"censor_surv cannot be {censor_surv}. Use e.g. 'km'")
File D:\anaconda3\envs\pytorch\lib\site-packages\pycox\evaluation\eval_surv.py:107, in EvalSurv.add_km_censor(self, steps)
104 km = utils.kaplan_meier(self.durations, 1-self.events)
105 surv = pd.DataFrame(np.repeat(km.values.reshape(-1, 1), len(self.durations), axis=1),
106 index=km.index)
--> 107 return self.add_censor_est(surv, steps)
File D:\anaconda3\envs\pytorch\lib\site-packages\pycox\evaluation\eval_surv.py:95, in EvalSurv.add_censor_est(self, censor_surv, steps)
84 """Add censoring estimates so one can use inverse censoring weighting.
85
censor_surv
are the survival estimates trained on (durations, 1-events),86
(...)
92 or lower index 'post'. If
None
useself.steps
(default: {None})93 """
94 if not isinstance(censor_surv, EvalSurv):
---> 95 censor_surv = self._constructor(censor_surv, self.durations, 1-self.events, None,
96 steps=steps)
97 self.censor_surv = censor_surv
98 return self
File D:\anaconda3\envs\pytorch\lib\site-packages\pycox\evaluation\eval_surv.py:36, in EvalSurv.init(self, surv, durations, events, censor_surv, censor_durations, steps)
34 self.censor_durations = censor_durations
35 self.steps = steps
---> 36 assert pd.Series(self.index_surv).is_monotonic
File D:\anaconda3\envs\pytorch\lib\site-packages\pandas\core\generic.py:5989, in NDFrame.getattr(self, name)
5982 if (
5983 name not in self._internal_names_set
5984 and name not in self._metadata
5985 and name not in self._accessors
5986 and self._info_axis._can_hold_identifiers_and_holds_name(name)
5987 ):
5988 return self[name]
-> 5989 return object.getattribute(self, name)
AttributeError: 'Series' object has no attribute 'is_monotonic'
Have you ever encountered this problem? Thank you!
The text was updated successfully, but these errors were encountered: