분류 전체보기

    [Pandas] 정보 탐색 및 정렬

    [Pandas] 정보 탐색 및 정렬

    1. 데이터 프레임 정보탐색 - read_fileType(route) : 파일 읽기, 특정 부분만 읽기 가능 CCTV_Seoul = pd.read_csv("../data/01. Seoul_CCTV.csv", encoding="utf-8") pop_Seoul = pd.read_excel("../data/01. Seoul_Population.xls") pop_Seoul = pd.read_excel( "../data/01. Seoul_Population.xls", header=2, usecols="B,D,G,J,N" ) - rename() : 이름 변경 가능, inplace=True 시, 변경 결과가 저장 pop_Seoul.rename( columns={ pop_Seoul.columns[0]:"구별", pop..

    [Pandas] Pandas란?

    [Pandas] Pandas란?

    🔍 Pandas란? - python에서 R만큼의 강력한 데이터 핸들링 성능을 제공하는 모듈 - 단일 프로세스에서는 최대 효율 - 코딩 가능하고 응용 가능한 엑셀로 받아들여도 됨(스테로이드 맞은 엑셀) import pandas as pd 🗝 Pandas 자료구조 - Pandas에서는 기본적으로 정의되는 자료구조인 Series와 Data Frame을 사용. 1) series - index와 value로 이루어져 있음 - 한가지 타입만 가질 수 있음 - 수로만 이루어져 있으면 연산 가능 pd.Series([1,2,3,4]) pd.Series([1,2,3,4], dtype=np.float64) pd.Series(np.array([1,2,3,4])) pd.Series({"key":"value"}) data % 2..

    [빅데이터] 미니콘다(miniconda) vs 아나콘다(Anaconda)

    [빅데이터] 미니콘다(miniconda) vs 아나콘다(Anaconda)

    🔍 콘다란? - 언어의 패키지, 의존관계와 환경을 관리하는 툴 - 파이썬, R , 스칼라 , 자바 , 자바 등을 지원 1. 미니콘다(miniconda) 1) 특징 - 아나콘다의 부트스트랩 버전 - Conda, Python, 의존하는 패키지 및 pip, zlib 및 기타 몇 가지를 포함한 소수의 기타 유용한 패키지만 포함 - 기본적인 요구 사항만 포함하고 있으며, 원하는 패키지를 그때그때 설치하여 사용 2) 이런 사람들에게 추천 - 아나콘다를 설치한 시간이나 디스크 공간이 없을때 - 파이썬과 conda 명령에 빠르게 액세스 가능 Miniconda — Conda documentation Miniconda is a free minimal installer for conda. It is a small, boot..

    [LeetCode] Find All Numbers Disappeared in an Array

    [LeetCode] Find All Numbers Disappeared in an Array

    🔍 문제 Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums. Input: nums = [4,3,2,7,8,2,3,1] Output: [5,6] Input: nums = [1,1] Output: [2] Tip) The intuition behind using a hash map is pretty clear in this case 🖥 실행 1) Answer(Hash Table) class Solution(object): def findDisappearedNumbers(self, num..

    [LeetCode] Third Maximum Number

    [LeetCode] Third Maximum Number

    🔍 문제 Given an integer array nums, return the third distinct maximum number in this array. If the third maximum does not exist, return the maximum number. Input: nums = [3,2,1] Output: 1 Explanation: The first distinct maximum is 3. The second distinct maximum is 2. The third distinct maximum is 1. 🖥 실행 1) Answer class Solution: def thirdMax(self, nums: List[int]) -> int: for i in nums: while num..

    [LeetCode] Max Consecutive Ones II

    [LeetCode] Max Consecutive Ones II

    🔍 문제 Given a binary array nums, return the maximum number of consecutive 1's in the array if you can flip at most one 0. nput: nums = [1,0,1,1,0] Output: 4 Explanation: Flip the first zero will get the maximum number of consecutive 1s. After flipping, the maximum number of consecutive 1s is 4. 🖥 실행 1) Answer class Solution(object): def findMaxConsecutiveOnes(self, nums): # previous and current l..

    [LeetCode] Height Checker

    [LeetCode] Height Checker

    🔍 문제 A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer array expected where expected[i] is the expected height of the ith student in line. You are given an integer array heights representing the current order that the students are standing in. Eac..

    [LeetCode] Move Zeroes

    [LeetCode] Move Zeroes

    🔍 문제 Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array. Input: nums = [0,1,0,3,12] Output: [1,3,12,0,0] Input: nums = [0] Output: [0] 🖥 실행 1) Answer class Solution: def moveZeroes(self, nums: List[int]) -> None: n = 0 while nums.count(0) > n: nums.remove(..