pyspark.sql.functions.initcap¶
-
pyspark.sql.functions.
initcap
(col: ColumnOrName) → pyspark.sql.column.Column[source]¶ Translate the first letter of each word to upper case in the sentence.
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or str target column to work on.
- col
- Returns
Column
string with all first letters are uppercase in each word.
Examples
>>> spark.createDataFrame([('ab cd',)], ['a']).select(initcap("a").alias('v')).collect() [Row(v='Ab Cd')]