Auerilas / ecopy

Python tools for ecological data analyses
64 stars 27 forks source link

Running the example in README.rst and found some potential bugs #4

Closed essicolo closed 8 years ago

essicolo commented 8 years ago

Hi,

I'm not so good with Python and Git so I preferred mentioning some errors here rather than committing. I installed ecopy via pip on Anaconda, Python 3.5. To run import ecopy as ep, I had to add a . before each module to import in the __init__.py files of base_funcs, diversity, matrix_comp and ordination, e.g.

from .pca import pca
from .correspondance import ca
from .pcoa import pcoa
from .distance import distance
from .transform import transform
from .mds import MDS
from .hillsmith import hillsmith
from .ord_plot import ord_plot

I tried to run your example, but found some errors, probably due to incoherence from previous versions.

prcomp = ep.pca(USArrests, scaled = True)

scaled should be scale and USArrests should be USArrests.iloc[:,1:] to remove the non-numeric column.

prcomp = ep.pca(USArrests.iloc[:,1:], scale = True)

prcomp.summary() should be

prcomp.summary_imp()
prcomp.summary_rot()
prcomp.summary_desc()

In prcomp.biplot(scale = 0), as well as prcomp.biplot(scale = 1, obsNames = True), you might remove the scale argument, since it's no longer there in pca.py. The example on lines 47 to 52 in pca.py should be updated accordingly.

Regards,

Essi

Auerilas commented 8 years ago

Thanks! The 'scaled' issue arises from a typo in the ReadMe. Good catch. And thanks for the suggestions for Python 3.x compatibility, everything worked fine on Python 2.x but I guess 3.x needs the period in from of the folders.

The non-numeric column in USArrests arises from a change in pandas, it used to import the state names as the index and now it imports them as columns in the pandas 0.18.

And finally, the biplot(scale) command has been replaced with a biplot(type) command. I've fixed that documentation as well.

You're correct, this is all due to to changes from previous versions, so thanks for catching these errors! Everything has been corrected.