idx_to_string = IndexToString(inputCol='categoryIndex', outputCol=
    'categoryValue')
idx_to_string.transform(indexed_df).drop('id').distinct().show()
Preserve index-string correspondence spark string indexer