Skip to content

Commit e89376c

Browse files
committed
Better checking
1 parent 22703dd commit e89376c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

python/pyspark/mllib/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,9 @@
2323
# MLlib currently needs NumPy 1.4+, so complain if lower
2424

2525
import numpy
26-
ver = numpy.version.version
2726

28-
fd = ver.find('.')
29-
ver1 = int(ver[: fd])
30-
ver = ver[fd + 1:]
31-
ver2 = int(ver[: ver.find('.')])
32-
33-
if ver1 < 1 or (ver1 == 1 and ver2 <= 4):
27+
ver = [int(x) for x in numpy.version.version.split(.)[:2]]
28+
if ver < [1, 4]:
3429
raise Exception("MLlib requires NumPy 1.4+")
3530

3631
__all__ = ['classification', 'clustering', 'feature', 'fpm', 'linalg', 'random',

0 commit comments

Comments
 (0)