본문 바로가기

전체 글

(13)
[pandas] 데이터 타입 관련_dtypes, astype(), to_numeric 데이터 전처리할 때, 범주형 데이터와 수치형 데이터를 구분해주고 적절하게 처리해주는 과정이 필요하다. 이 때 사용하는 여러 데이터 타입 관련 함수를 알아보자. 간단한 데이터셋을 만들어준다. (오늘도 열일하는 chatGPT) import pandas as pd data = {'name': ['John', 'Mary', 'Sara', 'David', 'Peter'], 'age': [25, 30, 35, 40, 45], 'city': ['New York', 'San Francisco', 'Boston', 'Chicago', 'Miami'], 'salary': ['2500', '3000', '3500', '4000', '4500']} df = pd.DataFrame(data) df 습관처럼 사용해주는 info(..
[pandas] 중복값 제거_duplicated() , drop_duplicates() 데이터를 정제하고 살펴보는 과정에서, 중복값이 있는지 확인하고 있다면 제거해야한다. 이 때 사용하는 duplicated()와 drop_duplicates() 함수를 살펴보자 https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.duplicated.html pandas.DataFrame.duplicated — pandas 1.5.3 documentation Only consider certain columns for identifying duplicates, by default use all of the columns. pandas.pydata.org 간단한 데이터셋을 만들어준다. chatGPT한테 물어보면 안되는게 없는 세상이다. import pa..
[Google Colab] 내 구글 드라이브 mount하기 from google.colab import drive drive.mount('/content/drive') 'drivce'라는 폴더명으로 colab과 내 구글 드라이브를 연동할 수 있음.
Jupyter Notebook - matplotlib 한글 폰트 깨짐 방지 %config InlineBackend.figure_format = 'retina' import matplotlib.pyplot as plt import matplotlib.font_manager as fm fontpath = '/usr/share/fonts/truetype/nanum/NanumBarunGothic.ttf' font = fm.FontProperties(fname=fontpath, size=9) plt.rc('font', family='NanumBarunGothic')
Jupyter Notebook - 가상 환경 설치 가상 환경 생성 conda create -n 가상환경 이름 * 해당 python version으로 가상환경 설치하기 conda create -n 가상환경 이름 python=3.8 가상 환경 활성화 / 비활성화 conda activate 가상환경 conda deactivate 가상환경 ipykernel 설치 pip install ipykernel python -m ipykernel install --user --name 가상환경 이름 가상환경 삭제 jupyter kernelspec uninstall 커널 이름 conda remove --name 가상환경 이름 --all