본문 바로가기

Python & SQL63

[sklearn] Data Scaling (Standard / minmax / maxabs / Robust) Data Scaling¶ 학습에 사용될 데이터를 단위 통일화시키는 작업 서로 다른 단위나 값의 크기를 가지는 컬럼별 데이터들의 분포나 단위를 일정하게 통일하는 작업 Standard Scaling Min-Max Scaling Max-Abs Scaling Robust Scailing In [8]: # 1. Standard Scaling # 평균 0, 표준편차 1로 데이터를 변화 (표준정규화) # (X-μ) / σ from IPython.core.display import display, HTML display(HTML("")) from sklearn.preprocessing import StandardScaler import numpy as np import matplotlib.pyplot as plt im.. 2022. 2. 27.
[Python-Leetcode] 232. Implement Queue using Stacks (difficulty : Easy - ☆) 문제 설명 Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Implement the MyQueue class: void push(int x) Pushes element x to the back of the queue. int pop() Removes the element from the front of the queue and returns it. int peek() Returns the element at the front of the queue. b.. 2021. 8. 12.
[Python-Leetcode] 739. dailyTemperatures (difficulty : Medium - ☆☆) 문제 설명 Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead. Example 1: Input: temperatures = [73,74,75,71,69,72,76,73] Output: [1,1,4,2,1,1,0,0] Example 2: Input: te.. 2021. 8. 11.
Python - Sorted (정렬, key 2개) 오름차순 / 내림차순 파이썬, Sorted 정렬 (Key 2개) dic1 = {'A':[(0, 1), (5, 1), (5, 3), (9, 2), (6, 2), (6, 1)]} dic1 {'A': [(0, 1), (5, 1), (5, 3), (9, 2), (6, 2), (6, 1)]} dic1['A']를 sorting할 때, 앞의 숫자는 증가하는 방향(오름차순) / 뒤의 숫자는 내림차순하도록 하려면 sorted(dic1['A'], key=lambda x:(x[0], -x[1])) [(0, 1), (5, 3), (5, 1), (6, 2), (6, 1), (9, 2)] sorted에서, key는 어떤 것을 기준으로 sort를 할 것인지를 정하는 것입니다. x[0]은 앞의 숫자를 기준으로 오름차순이며, -x[1]은 뒤의 숫자를 기준.. 2021. 8. 9.
[Programmers 문제풀이] 해시 - 베스트앨범 ❓ 위장 https://programmers.co.kr/learn/courses/30/lessons/42579?language=python3 코딩테스트 연습 - 베스트앨범 스트리밍 사이트에서 장르 별로 가장 많이 재생된 노래를 두 개씩 모아 베스트 앨범을 출시하려 합니다. 노래는 고유 번호로 구분하며, 노래를 수록하는 기준은 다음과 같습니다. 속한 노래가 programmers.co.kr 🅿 문제 설명 스트리밍 사이트에서 장르 별로 가장 많이 재생된 노래를 두 개씩 모아 베스트 앨범을 출시하려 합니다. 노래는 고유 번호로 구분하며, 노래를 수록하는 기준은 다음과 같습니다. 속한 노래가 많이 재생된 장르를 먼저 수록합니다. 장르 내에서 많이 재생된 노래를 먼저 수록합니다. 장르 내에서 재생 횟수가 같은 노래.. 2021. 8. 9.
[Programmers] 해시 - 위장 ❓ 위장 https://programmers.co.kr/learn/courses/30/lessons/42578 코딩테스트 연습 - 위장 programmers.co.kr 🅿 문제 설명 스파이들은 매일 다른 옷을 조합하여 입어 자신을 위장합니다. 예를 들어 스파이가 가진 옷이 아래와 같고 오늘 스파이가 동그란 안경, 긴 코트, 파란색 티셔츠를 입었다면 다음날은 청바지를 추가로 입거나 동그란 안경 대신 검정 선글라스를 착용하거나 해야 합니다. 종류이름 얼굴 동그란 안경, 검정 선글라스 상의 파란색 티셔츠 하의 청바지 겉옷 긴 코트 스파이가 가진 의상들이 담긴 2차원 배열 clothes가 주어질 때 서로 다른 옷의 조합의 수를 return 하도록 solution 함수를 작성해주세요. 제한사항 clothes의 각.. 2021. 8. 8.
728x90