[LeetCode] Pandas / 2885. Rename columns
2024. 7. 8. 14:52ㆍCoding/LeetCode-Pandas
문제 링크
https://leetcode.com/problems/rename-columns/description/
문제
코드
import pandas as pd
def renameColumns(students: pd.DataFrame) -> pd.DataFrame:
students.rename(
columns={
'id': 'student_id',
'first': 'first_name',
'last': 'last_name',
'age': 'age_in_years',
},
inplace=True,
)
return students
'Coding > LeetCode-Pandas' 카테고리의 다른 글
[LeetCode] Pandas / 2887. Fill missing data (0) | 2024.07.08 |
---|---|
[LeetCode] Pandas / 2886. Change data type (0) | 2024.07.08 |
[LeetCode] Pandas / 2884. Modify Columns (0) | 2024.07.08 |
[LeetCode] Pandas / 2883. Drop missing data (0) | 2024.07.08 |
[LeetCode] Pandas / 2882. Drop duplicate rows (0) | 2024.07.08 |