BinPro / CONCOCT

Clustering cONtigs with COverage and ComposiTion
Other
119 stars 48 forks source link

concoct_refine fails under pandas 0.25.1 and numpy 1.17.2 #272

Open Sebastien-Raguideau opened 4 years ago

Sebastien-Raguideau commented 4 years ago

Hello,

I just installed concoct among other things in a conda environment. It installed pandas 0.25.1 and numpy 1.17.2 in python 3.6.7 Which make reading the data fail at the step :

original_data = p.read_csv(args.original_data, header=0, index_col=0)
original_data_matrix = original_data.values()

Here is the exact error message

original_data_matrix = original_data.values()
TypeError: 'numpy.ndarray' object is not callable

One way to deal with the issue is to change concoct_refine so that it is compliant with whatever was twiked in numpy and or pandas. The other way would be for me to know what is the latest pandas and numpy version I can use in my conda env.

Can you help me with that?

Best,

Seb

alneberg commented 4 years ago

Ah, sorry about this. I think the original_data.values shouldn't be a method, but it is also deprecated. Would you mind checking if

original_data_matrix = original_data.to_numpy()

works instead?

Thank you, Johannes

Sebastien-Raguideau commented 4 years ago

Hi Johannes, So i was just looking into it and indeed when using the .as_matrix() it gives a message stating that it is deprecated and prompt user to use .values instead. So I just gave a quick test and it seems to work fine if it's not called : so original_data.valuesworks while original_data.values() does not

So, it's nice that it is easy to fix :)

Also just had a go at original_data_matrix = original_data.to_numpy() and it does not works, AttributeError: 'DataFrame' object has no attribute 'to_numpy'

Best

Seb

alneberg commented 4 years ago

Thanks for helping out!

Ok, so changing to values should work, but according to pandas documentation, to_numpy should be available from pandas 0.24.0 and on...

Do you want to put together a pull request and make it to the github contributors list, or do you want me to fix it?

chrisquince commented 4 years ago

OK I just tried fixing this by changing to to_numpy() but is there a reason why we prefer values. Given the instability of the pandas api the long term solution would be to remove the pandas dependence?