concept selectExpr() in category pyspark
appears as: selectExpr()

This is an excerpt from Manning's book Data Analysis with Python and PySpark.
Listing 7.17. Replacing
selectExpr()by a regularselect()in our final programfull_data = full_data.selectExpr( F.col("model"), (F.col("capacity_bytes") / F.pow(F.lit(1024), 3)).alias("capacity_GB"), F.col("date"), F.col("failure") )The second one is simply called
expr(). It wraps a SQL-style expression into a column. This is kind of a generalizedselectExpr(), where you can use it in lieu of ofF.col()(or the column name) when you want to modify a column. If we take ourfailurestable from listing 7.17, we can use anexpr(or expression) as theagg()argument. This alternative syntax is shown in listing 7.19. I like doing it inagg()parameters, because it saves a lot ofalias().