Skip to content

Commit 4530250

Browse files
zhengruifengdavies
authored andcommitted
[MINOR] Add python3 compatibility in python examples
## What changes were proposed in this pull request? Add python3 compatibility in python examples ## How was this patch tested? manual tests Author: Zheng RuiFeng <[email protected]> Closes #12868 from zhengruifeng/fix_gmm_py.
1 parent b85d21f commit 4530250

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

examples/src/main/python/ml/als_example.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
from __future__ import print_function
1919

20+
import sys
21+
if sys.version >= '3':
22+
long = int
23+
2024
from pyspark import SparkContext
2125
from pyspark.sql import SQLContext
2226

examples/src/main/python/mllib/gaussian_mixture_model.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
"""
2121
from __future__ import print_function
2222

23+
import sys
24+
if sys.version >= '3':
25+
long = int
26+
2327
import random
2428
import argparse
2529
import numpy as np

0 commit comments

Comments
 (0)