Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[SPARK-21866][ML][PYTHON][FOLLOWUP] Few cleanups and fix image test failure in Python 3.6.0 / NumPy 1.13.3 #19835
What changes were proposed in this pull request?
Image test seems failed in Python 3.6.0 / NumPy 1.13.3. I manually tested as below:
To be clear, I think the error seems from NumPy - https://github.com/numpy/numpy/blob/75b2d5d427afdb1392f2a0b2092e0767e4bab53d/numpy/core/src/multiarray/number.c#L947
For a smaller scope:
>>> import numpy as np >>> bytearray(np.array().astype(dtype=np.uint8)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: only integer scalar arrays can be converted to a scalar index
In Python 2.7 / NumPy 1.13.1, it prints:
So, here, I simply worked around it by converting it to bytes as below:
>>> bytearray(np.array().astype(dtype=np.uint8).tobytes()) bytearray(b'\x01')
Also, while looking into it again, I realised few arguments could be quite confusing, for example,
How was this patch tested?
Manually tested with