티스토리 뷰

df = df.withColumnRenamed("colName", "newColName")\
       .withColumnRenamed("colName2", "newColName2")

https://stackoverflow.com/questions/34077353/how-to-change-dataframe-column-names-in-pyspark

 

How to change dataframe column names in pyspark?

I come from pandas background and am used to reading data from CSV files into a dataframe and then simply changing the column names to something useful using the simple command: df.columns =

stackoverflow.com

 

댓글
댓글쓰기 폼