목록LeetCode 코딩테스트 (34)
무냐의 개발일지
df.rename(columns = {"level_0": "Feature 1", "level_1": "Feature 2", 0: 'Correlation Coefficient'}, inplace=True) 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 1. Two Sum class Solution: def twoSum(self, nums: List[in..
| Array에서 정렬하는 파라미터 Key #sorted에 아무런 key값 주지 않을 경우, 기본 ascending으로 출력 array = [3, 1, 5, 2, 4] sorted_array = sorted(array) print(sorted_array) # 출력: [1, 2, 3, 4, 5] #key=lambda x: x[0] #튜플에서 각 첫번째 요소 기준으로, 오름차순 정렬 array = [(1, 'b'), (3, 'a'), (2, 'c')] sorted_array = sorted(array, key=lambda x: x[0]) print(sorted_array) # 출력: [(1, 'b'), (2, 'c'), (3, 'a')] #key=len #문자열의 길이에 따른 정렬 array = ['appl..