nutapa
0
Q:

how to rename a column in pyspark dataframe

# Basic syntax:
# Assign column names to a Pandas dataframe:
pandas_dataframe.columns = ['list', 'of', 'column', 'names']
# Note, the list of column names must equal the number of columns in the
# 	dataframe and order matters

# Rename specific column names of a Pandas dataframe:
pandas_dataframe.rename(columns={'name_to_change':'new_name'})
# Note, with this approach, you can specify just the names you want to
# 	change and the order doesn't matter
5
df.withColumnRenamed("dob","DateOfBirth")
0

New to Communities?

Join the community