If there is no special requirement for the mapping order, you can directly sort the rankings according to the character order to map to integers.
data = [
('a',),
('c1',),
('3vc',),
('a',),
('c1',),
('fd',)
]
df = spark.createDataFrame(data, ['column'])
df = df.selectExpr('column', 'dense_rank() over (order by column) as int_col') \
.withColumn('mapping', F.expr('map(column, int_col)'))
df.show(truncate=False)
# +------+-------+----------+
# |column|int_col|mapping |
# +------+-------+----------+
# |3vc |1 |{3vc -> 1}|
# |a |2 |{a -> 2} |
# |a |2 |{a -> 2} |
# |c1 |3 |{c1 -> 3} |
# |c1 |3 |{c1 -> 3} |
# |fd |4 |{fd -> 4} |
# +------+-------+----------+