diff options
Diffstat (limited to 'python/pyspark/sql/functions.py')
-rw-r--r-- | python/pyspark/sql/functions.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py index 96975f54ff..a73ecc7d93 100644 --- a/python/pyspark/sql/functions.py +++ b/python/pyspark/sql/functions.py @@ -958,6 +958,18 @@ def substring_index(str, delim, count): return Column(sc._jvm.functions.substring_index(_to_java_column(str), delim, count)) +@ignore_unicode_prefix +@since(1.5) +def initcap(col): + """Translate the first letter of each word to upper case in the sentence. + + >>> sqlContext.createDataFrame([('ab cd',)], ['a']).select(initcap("a").alias('v')).collect() + [Row(v=u'Ab Cd')] + """ + sc = SparkContext._active_spark_context + return Column(sc._jvm.functions.initcap(_to_java_column(col))) + + @since(1.5) def size(col): """ |