Closed retorquere closed 4 years ago
It's correct that Python 3 is currently unsupported. I've looked into the possibility of adding compatibility -- for the most part is would likely only involve addressing the xrange issue which you point out, although there is also the issue of whether/how to support missing data using None. I hope to add Python 3 support shortly.
On Tue, 5 Jun 2018, Emiliano Heyns wrote:
When I try to compute the entropy of an array, I get the following error:
~/anaconda3/lib/python3.6/site-packages/pyitlib/discrete_random_variable.py in entropy(X, base, fill_value, estimator, Alphabet_X, keep_dims) 3852 H = np.reshape(H, (-1, 1)) 3853 -> 3854 _verify_alphabet_sufficiently_large(X, Alphabet_X, fill_value) 3855 3856 # NB: This is not joint entropy. Elements in each row are sorted
~/anaconda3/lib/python3.6/site-packages/pyitlib/discrete_random_variable.py in _verify_alphabet_sufficiently_large(X, Alphabet, fill_value) 4742 assert(not np.any(X == np.array(None))) 4743 assert(not np.any(Alphabet == np.array(None))) -> 4744 for i in xrange(X.shape[0]): 4745 I = X[i] != fill_value 4746 J = Alphabet[i] != fill_value
NameError: name 'xrange' is not defined
I think that's because I'm using Py3, and in Py3, xrange is now range.
? You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.[AJF5WJV0HE8Kwka0ECRysgL8-EqzD4OFks5t5qVkgaJpZM4UbEW4.gif]
Thanks for the great library. Indeed code itself is not py3 compatible but for me replacing xrange with range worked. I am using the methods with masked arrays, had not encountered problems with masked (missing) values.
I'd very much like official python3 support also.
I like this package. But if it is compatible with Python 3, it would be better.
I like this package. But if it is compatible with Python 3, it would be better.
@zhaoyanthu - If you change the xranges
to range
it should just work. I have a local copy which works on python3
after doing this.
I like this package. But if it is compatible with Python 3, it would be better.
@zhaoyanthu - If you change the
xranges
torange
it should just work. I have a local copy which works onpython3
after doing this.
Perfecto. It works very well. Thanks!
Many thanks for your comments everyone and please accept my apologies for the delayed update. @TMiguelT many thanks for your PR, I plan to make a new release this weekend.
Great! If you have time, you might be able to remember if you were using any integer division anywhere, and if not, I or you can fix the PR to switch everything to using Python 3 division
Thanks, I will review and switch accordingly.
On Wed, 28 Nov 2018, TMiguelT wrote:
Great! If you have time, you might be able to remember if you were using any integer division anywhere, and if not, I or you can fix the PR to switch everything to using Python 3 division
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.[AJF5WKYPE59wbxzSdZyxz3NrNy5zRdRUks5uzxnFgaJpZM4UbEW4.gif]
OK, I've released version 0.2.0, which implements Python 3 support. Let me know if you experience any issues getting it to run.
Python 3.7 works for me great
When I try to compute the entropy of an array, I get the following error:
I think that's because I'm using Py3, and in Py3, xrange is now range.