from pyspark import SparkConf
from pypsark.sql import SparkSession
from pyspark.sql import functions
spark..., 20, 'green', '["Jane", 20, "green"]'],
['Mary', 21, 'blue', '["Mary", 21, "blue"]'], ]
frame = spark.createDataFrame...+—–+———–+
| name|name_length|
+—–+———–+
|Alice| 5|
| Jane| 4|
| Mary| 4|
+—–+———–+
2.3 使用 selectExpr...frame3_3 = frame.selectExpr(["name", "length(name) as name_length"])
frame3_3.show()
+—–+———–+
|