Skip to content

2885. Rename Columns 👍

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import pandas as pd


def renameColumns(students: pd.DataFrame) -> pd.DataFrame:
  return students.rename(
      columns={
          "id": "student_id",
          "first": "first_name",
          "last": "last_name",
          "age": "age_in_years",
      }
  )