Library(15)
-
[LeetCode] Pandas / 2885. Rename columns
문제 링크https://leetcode.com/problems/rename-columns/description/ 문제 코드 import pandas as pddef 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
2024.07.08 -
[LeetCode] Pandas / 2884. Modify Columns
문제 링크https://leetcode.com/problems/modify-columns/description/ 문제 코드import pandas as pddef modifySalaryColumn(employees: pd.DataFrame) -> pd.DataFrame: employees['salary'] = employees['salary']*2 return employees
2024.07.08 -
[LeetCode] Pandas / 2883. Drop missing data
문제 링크https://leetcode.com/problems/drop-missing-data/description/ 문제 코드import pandas as pddef dropMissingData(students: pd.DataFrame) -> pd.DataFrame: return students[students['name'].notnull()]
2024.07.08 -
[LeetCode] Pandas / 2882. Drop duplicate rows
문제 링크https://leetcode.com/problems/drop-duplicate-rows/description/ 문제 코드import pandas as pddef dropDuplicateEmails(customers: pd.DataFrame) -> pd.DataFrame: return customers.drop_duplicates(subset=['email'])
2024.07.08 -
[LeetCode] Pandas / 2881. Create a new column
문제 링크https://leetcode.com/problems/create-a-new-column/description/ 문제 코드import pandas as pddef createBonusColumn(employees: pd.DataFrame) -> pd.DataFrame: employees['bonus'] = employees['salary']*2 return employees
2024.07.08 -
[LeetCode] Pandas / 2880. Select Data
문제 링크https://leetcode.com/problems/select-data/description/ 문제 코드import pandas as pddef selectData(students: pd.DataFrame) -> pd.DataFrame: return students[students.student_id == 101][["name", "age"]]
2024.07.08