pyspark.sql.Column.alias — PySpark 3.3.1 documentation
spark.apache.org › pysparkpyspark.sql.Column.alias ¶ Column.alias(*alias: str, **kwargs: Any) → pyspark.sql.column.Column [source] ¶ Returns this column aliased with a new name or names (in the case of expressions that return more than one column, such as explode). New in version 1.3.0. Parameters aliasstr desired column names (collects all positional arguments passed)
python - Alias in Pyspark - Stack Overflow
stackoverflow.com › questions › 61499910Apr 29, 2020 · Alias is inherited from SQL syntax. That's a way to rename a variable within a query (e.g. a select ). It avoids creating a temporary name you don't choose and having to rename the variable afterwards with something like withColumnRenamed. For instance, df.select ( [count (when (isnan (c), c)).alias (c) for c in df.columns]).show () Ensures that the result of the count operation will return a new variable with the same name than in df object.