Column.
alias
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.
desired column names (collects all positional arguments passed)
a dict of information to be stored in metadata attribute of the corresponding StructField (optional, keyword only argument)
metadata
StructField
Changed in version 2.2.0: Added optional metadata argument.
Examples
>>> df.select(df.age.alias("age2")).collect() [Row(age2=2), Row(age2=5)] >>> df.select(df.age.alias("age3", metadata={'max': 99})).schema['age3'].metadata['max'] 99