nxcals.api.extraction.data.builders.DataFrame.withColumnRenamed

DataFrame.withColumnRenamed(existing: str, new: str) DataFrame

Returns a new DataFrame by renaming an existing column. This is a no-op if schema doesn’t contain the given column name.

New in version 1.3.0.

Parameters:
  • existing (str) – string, name of the existing column to rename.

  • new (str) – string, new name of the column.

Examples

>>> df.withColumnRenamed('age', 'age2').collect()
[Row(age2=2, name='Alice'), Row(age2=5, name='Bob')]