LeetCode solutions

3068. Rename Columns

My accepted Python solution to LeetCode problem 3068, Rename Columns, running in 243ms.

  • Difficulty: Easy
  • Python
  • Runtime 243ms
  • Memory 66.4MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 243ms, memory 66.4MB, accepted 2026-01-02.

python
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'})

Source