transformed = indexer.fit(ratings_df).transform(ratings_df).withColumn(
    'user_id', col('user_id').cast('integer')).select('user_id', 'item_id',
    'rating')
Transform input data for ALS in pyspark