python 공부하며 알게된 것들
Updated:
-
라이브러리
pandas: 숫자 테이블과 시계열을 조작하기 위한 데이터 구조와 연산을 제공하는 라이브러리
numpy: numerical python 의 줄임말. 고성능의 수치계산을 위해 제작되었으며, 벡터와 행렬 연산 시 효과적으로 이용할 수 있고, 보통 array(행렬)를 단위로 데이터 관리 및 연산을 수행. -
CSV: Comma seperated values의 줄임말
- 구글 colab에 로컬PC 데이터 파일 업로드하기
#파일 업로드 기능 실행 from google.colab import files uploaded = files.upload() #파일 정보 출력 for fn in uploaded.keys(): print('User uploaded file "{name}" with length {length} bytes'.format(name=fn, length=len(uploaded[fn])))
- 특정 조건 행 추출하기
#train df에서 accountid 컬럼 값이 312인 행 추출 train[train['accountid'] == 312]
#train df에서 teamid 컬럼 값이 0인 행 추출 train.query('teamid == 0')
#train df에서 matchid 컬럼 값이 0x를 포함하는 행 추출 train.loc[train['matchid'].str.contains('0x')]
- 2개의 df 연결하기
train_test = pd.concat([train,test])
Leave a comment