Skip to content

Commit 9a26341

Browse files
authored
Modified code block as per User Review
Modified code block as per User Review
1 parent 72bcd57 commit 9a26341

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

articles/hdinsight/spark/apache-spark-machine-learning-mllib-ipython.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to use Spark MLlib to create a machine learning app that
44
ms.service: hdinsight
55
ms.topic: how-to
66
ms.custom: hdinsightactive, devx-track-python
7-
ms.date: 06/23/2023
7+
ms.date: 04/08/2024
88
---
99

1010
# Use Apache Spark MLlib to build a machine learning application and analyze a dataset
@@ -60,9 +60,9 @@ Use the Spark context to pull the raw CSV data into memory as unstructured text.
6060
```PySpark
6161
def csvParse(s):
6262
import csv
63-
from StringIO import StringIO
63+
from io import StringIO
6464
sio = StringIO(s)
65-
value = csv.reader(sio).next()
65+
value = next(csv.reader(sio))
6666
sio.close()
6767
return value
6868
@@ -288,8 +288,8 @@ You can use the model you created earlier to *predict* what the results of new i
288288
results = 'Pass w/ Conditions'))""").count()
289289
numInspections = predictionsDf.count()
290290
291-
print "There were", numInspections, "inspections and there were", numSuccesses, "successful predictions"
292-
print "This is a", str((float(numSuccesses) / float(numInspections)) * 100) + "%", "success rate"
291+
print ("There were", numInspections, "inspections and there were", numSuccesses, "successful predictions")
292+
print ("This is a", str((float(numSuccesses) / float(numInspections)) * 100) + "%", "success rate")
293293
```
294294
295295
The output looks like the following text:

0 commit comments

Comments
 (0)