본문 바로가기

Programming

(9)
[Pandas] DataFrame 더 많은 행과 열 출력하기 1. 더 많은 행 출력하기 import pandas as pd pd.set_option('display.max_row', 100) 2. 더 많은 열 출력하기 import pandas as pd pd.set_option('display.max_columns', 100)
[Git] MacOS에서 GitHub 연결하기 1. Homebrew를 통한 Git 설치 Mac에 설치되어 있는 Homebrew를 통해 Git을 설치합니다. 사용 중인 터미널을 통하여 아래의 명령어를 입력합니다. Brew install git 2. GitHub Repository 연결 개인 GitHub에 Repository를 생성을 완료한 상태라고 보겠습니다. Repository 생성 시, 초기 설정된 Default 상태로 진행하여도 무방합니다. Repository 생성이 완료되었으면, 로컬 맥북에서 GitHub와 연동하고 싶은 디렉토리를 설정합니다. Documents에 임의로 workspace라는 폴더를 생성했다고 가정해보겠습니다. 터미널을 통해 해당 디렉토리로 이동합니다. cd Documents/workspace 이동이 완료하였으면 기본 Git 설..
[Git] 특정 branch clone하기 // 실제로 사용할 때는 "" 생략 git clone "git https 주소" -b "branch 이름"
[Python] 문자열 앞에 0을 채우는 방법(zfill, rjust) 1. zfill() 함수 사용 "3".zfill(3) # "003" "50".zfill(5) # "00050" "hi".zfill(5) # "000hi" 2. rjust() 함수 사용 "3".rjust(3, "0") # "003" "50".rjust(5, "0") # "00050" "hi".rjust(5, "a") # "aaahi" rjust는 0 이외에도 원하는 문자열을 채워줄 수 있는 특징이 있다.
[Linux] 파일, 폴더 복사하기 1. 파일 복사하기 cp "복사할 파일 디렉토리" "목적지 디렉토리" 2. 디렉토리 안 모든 파일 복사하기 cp -r * "목적지 디렉토리" 3. 폴더 복사하기 cp -r "복사할 디렉토리" "목적지 디렉토리"
[Numpy] Numpy 행렬에 함수 적용하기 # Numpy version: 1.19.3 import math import numpy as np def sin_func(x): return math.sin(x) x = np.arange(0, 4*math.pi, step=math.pi/360) vecfunc = np.vectorize(sin_func) y = vecfunc(x)
[Pandas] DataFrame 기간별 데이터 산출하기 1. resample() 사용하기 # 1달 단위 개수 확인 df["timestamp"] = pd.to_datetime(df["timestamp"]) df.set_index("timestamp").resample("1M").count() 참고) https://rfriend.tistory.com/494
[Pandas] DataFrame에서 특정 리스트에 해당하는 열 추출하기 isin() 사용하기 # pandas version : 1.3.3 mask = df["No"].isin([1,2,3]) df[mask]