Skip to content

Commit

Permalink
Test for contains in Python
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-iskw committed Jul 16, 2015
1 parent 6566c8b commit 4a03003
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/pyspark/ml/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class KMeans(JavaEstimator, HasFeaturesCol, HasMaxIter, HasSeed):
>>> centers = model.clusterCenters()
>>> len(centers)
2
>>> transformed = model.transform(df)
>>> (transformed.columns)[0] == 'features'
>>> transformed = model.transform(df).select("features", "prediction")
>>> "features" in transformed.columns
True
>>> (transformed.columns)[1] == 'prediction'
>>> "prediction" in transformed.columns
True
>>> rows = sorted(transformed.collect(), key = lambda r: r[0])
>>> rows = transformed.collect()
>>> rows[0].prediction == rows[1].prediction
True
>>> rows[2].prediction == rows[3].prediction
Expand Down

0 comments on commit 4a03003

Please sign in to comment.