Skip to content

Instantly share code, notes, and snippets.

@kshirsagarsiddharth
Created June 23, 2021 16:45
Show Gist options
  • Select an option

  • Save kshirsagarsiddharth/1de1850f1ca1e7e31db95fec7fba049d to your computer and use it in GitHub Desktop.

Select an option

Save kshirsagarsiddharth/1de1850f1ca1e7e31db95fec7fba049d to your computer and use it in GitHub Desktop.
from pyspark.ml.recommendation import ALS
from pyspark.ml.evaluation import RegressionEvaluator
from pyspark.ml.feature import StringIndexer
indexer = StringIndexer(inputCol = "isbn", outputCol = "isbn_indexed")
indexed = indexer.fit(filtered_with_location).transform(filtered_with_location)\
.withColumn('isbn_indexed',F.col('isbn_indexed')\
.cast("int"))\
.drop('isbn')
indexed.printSchema()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment