Column.
substr
Return a Column which is a substring of the column.
Column
New in version 1.3.0.
Changed in version 3.4.0: Supports Spark Connect.
start position
length of the substring
Column representing whether each element of Column is substr of origin Column.
Examples
>>> df = spark.createDataFrame( ... [(2, "Alice"), (5, "Bob")], ["age", "name"]) >>> df.select(df.name.substr(1, 3).alias("col")).collect() [Row(col='Ali'), Row(col='Bob')]