목록Python (5)
IT 세계의 후아
※ 2차원 리스트(배열)접근할 때 배열 틀 제대로 갖추지 않고 무턱대고 값을 저장하면 index error 남!!#프로그래머스 lv1 행렬의 덧셈def solution(arr1, arr2): answer = [] for i in range(len(arr1)): answer.append([]) # arr1, arr2와 같이 2차원 배열로 틀 갖추기 for j in range(len(arr1[i])): answer[i].append(arr1[i][j] + arr2[i][j]) return answer # 다른 사람 풀이 return [list(map(sum, zip(*x))) for x in zip(A, B)] return ..
※ 문자열.isdigit()문자열이 '숫자'로만 구성돼있는지 확인하는 함수따로 chr, ord 함수를 활용하지 않아도 간단하게 풀 수 있음!!# 프로그래머스 lv1 문자열 다루기 기본def solution(s): a = [i for i in s if ord(i)>=48 and ord(i)
금융 데이터를 다뤄보고 싶던 중 Kaggle에서 이미 완료된 대회를 발견했다..!친절하게도 beginner(나같이 다 까먹은 전공자도,,^^)를 위한 코드와 설명이 돼있어서 복습할 겸 수행해보았다. https://www.kaggle.com/code/miingkang/ml-from-the-beginning-to-the-end-for-newbies/notebook ML from the beginning to the end (For newbies🐢)Explore and run machine learning code with Kaggle Notebooks | Using data from multiple data sourceswww.kaggle.com First. Big Picture -🏔To attempt ..

https://hoooa.tistory.com/36 [kaggle]Ubiquant Market Prediction금융 데이터를 다뤄보고 싶던 중 Kaggle에서 이미 완료된 대회를 발견했다..!친절하게도 beginner(나같이 다 까먹은 전공자도,,^^)를 위한 코드와 설명이 돼있어서 복습할 겸 수행해보았다. https://www.hoooa.tistory.com위의 문제를 수행하다가 맞닥뜨린 인덱스 문제..! 찾아보니 Pandas에선 float16 index가 제공이 안 된다..라는 게 포인트여서 어떤 게 float이었나 봤더니 groupby 하고 count하려는 열이 모두 float 형태여서 오류가 난 것..! 그래서 두 열의 데이터 타입 변경해줌으로써 해결~
※ dict() == {}dict([('a', '가'), ('b', '나'), ( , ), ... ])== dict({'a': '가', 'b': '나', '': '', ...})== dict(zip(['a', 'b', ... ], ['가', '나', ... ])) != dict([], []) # 그냥 리스트 두 개만 넣으면 안 됨!!! a_dic.keys(): 키값만 담은 dict_key 객체 returnlist(a_dic.keys())for k in a_dic.keys(): print(k)a_dic.get('키') == a_dic['키'] a_dic.values()a_dic.items(): dict_items[(키, 값), (키, 값), ...] 객체 return# 프로그래머스 lv0 옷가게 ..