3068. Rename Columns
My accepted Python solution to LeetCode problem 3068, Rename Columns, running in 243ms.
- Difficulty: Easy
- Python
- Runtime 243ms
- Memory 66.4MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 243ms, memory 66.4MB, accepted 2026-01-02.
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'})