cvxportfolio icon indicating copy to clipboard operation
cvxportfolio copied to clipboard

null_checker requires extra np.any()

Open thayes75 opened this issue 5 years ago • 3 comments

I'm wondering if it's perhaps a result of new pandas behaviour, but I had to change the null_checker (line 29 in data_management.py) to read as:

if np.any( np.any(np.any(pd.isnull(obj))) ):

for the HelloWorld example to run. Seems to be an issue in that it spits out a series of "False" values and it requires a single bool value. Can anyone confirm? I'm on Pandas 0.20.3.

thayes75 avatar Oct 06 '19 17:10 thayes75

I had same issue. You are right. It is because pandas behavior changed with newer version

Sent from my iPhone

On Oct 6, 2019, at 1:43 PM, thayes75 [email protected] wrote:

I'm wondering if it's perhaps a result of new pandas behaviour, but I had to change the null_checker (line 29 in data_management.py) to read as:

if np.any( np.any(np.any(pd.isnull(obj))) ):

for the HelloWorld example to run. Seems to be an issue in that it spits out a series of "False" values and it requires a single bool value. Can anyone confirm? I'm on Pandas 0.20.3.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

kch382001 avatar Oct 06 '19 18:10 kch382001

If that is the case, you should probably use np.any(pd.isnull(obj).values.reshape(1,-1)) so that the code doesn't assume the object is a pd.Panel. Apparently you can also use obj.isnull().any(axis=None) which works with Series, Dataframes, and Panels.

joseortiz3 avatar Oct 06 '19 21:10 joseortiz3

null checker still has the above issue with 0.0.12.

thayes75 avatar Apr 20 '20 15:04 thayes75