์ ์ฒด ๊ธ36 [python/ํ์ด์ฌ] Numpy ๋ํ์ด (1) ๋ํ์ด(Numpy) ๋ํ์ด(Numpy)๋ ์์น ๋ฐ์ดํฐ๋ฅผ ๋ค๋ฃจ๋ ํ์ด์ฌ ํจํค์ง ๋ค์ฐจ์ ํ๋ ฌ ์๋ฃ๊ตฌ์กฐ์ธ ndarray๋ฅผ ํตํด ๋ฒกํฐ ๋ฐ ํ๋ ฌ์ ์ฌ์ฉํ๋ ์ ํ ๋์ ๊ณ์ฐ์์ ์ฃผ๋ก ์ฌ์ฉ # ์๋์ฝ๋ค๋ฅผ ์ค์นํ์ง ์์๋ค๋ฉด numpy ๋ณ๋ ์ค์น pip install numpy 1. Numpy arrays 1D array : axis0 2D array : axis0. axis1 3D array : axis0, axis1, axis2 2. Creating arrays Numpy์ ํต์ฌ์ ndarray. np.array()๋ ๋ฆฌ์คํธ, ํํ, ๋ฐฐ์ด๋ก ๋ถํฐ ndarray ์์ฑ import numpy as np 1์ฐจ์ ๋ฐฐ์ด ์์ฑ a = np.array([1, 2, 3]) a array([1, 2, 3]) 2์ฐจ์ ๋ฐฐ์ด ์์ฑ. ์ฃผ์.. 2022. 8. 15. [python/ํ์ด์ฌ] ๋ฉ๋ก ์ฐจํธ ํฌ๋กค๋ง ๋ฉ๋ก ์ฐจํธ ํฌ๋กค๋ง ๋ฉํฐ์บ ํผ์ค ๊ตญ๋น์ง์ '์๋น์ค ์ฐ์ ๋ฐ์ดํฐ๋ฅผ ํ์ฉํ ๋น ๋ฐ์ดํฐ ๋ถ์' ๊ณผ์ ์ ์๊ฐํ๋ฉฐ ์ฒซ ๋ฒ์งธ๋ก ํ๋ ํ๋ก์ ํธ # 2021๋ 12์ ์๊ฐ top100 ๋ฐ์ดํฐ ํฌ๋กค๋ง ํ ์ ํธ ์ฅ๋ฅด ์กฐ์ฌ # ๋ผ์ด๋ธ๋ฌ๋ฆฌ import import sys import os import pandas as pd import numpy as np from selenium import webdriver from selenium.webdriver import ActionChains as AC import chromedriver_autoinstaller from tqdm import tqdm from tqdm import tqdm_notebook import re from time import sleep import time.. 2022. 8. 10. [python/ํ์ด์ฌ] ํ๋ค์ค ํ๋กํ์ผ๋ง(Pandas-Profiling) ํ๋ค์ค ํ๋กํ์ผ๋ง(Pandas Profiling) ์ข์ ๋จธ์ ๋ฌ๋ ๊ฒฐ๊ณผ๋ฅผ ์ป๊ธฐ ์ํด์ ๋ฐ์ดํฐ์ ์ฑ๊ฒฉ์ ํ์ ํ๋ ๊ณผ์ ์ด ์ ํ๋์ด์ผ ํ๋ค. ์ด ๊ณผ์ ์์ ๋ฐ์ดํฐ ๋ด ๊ฐ์ ๋ถํฌ, ๋ณ์ ๊ฐ์ ๊ด๊ณ, Null๊ฐ๊ณผ ๊ฐ์ ๊ฒฐ์ธก๊ฐ(missing values)์กด์ฌ ์ ๋ฌด ๋ฑ์ ํ์ ํ๊ฒ ๋๋๋ฐ ์ด์ ๊ฐ์ด ๋ฐ์ดํฐ๋ฅผ ํ์ ํ๋ ๊ณผ์ ์ EDA(Exploratory Data Analysis, ํ์์ ๋ฐ์ดํฐ ๋ถ์) ์ด๋ผ๊ณ ํ๋ค. ์ด๋ฌํ ํ์์ ๋ฐ์ดํฐ ๋ถ์์ ๋๋ ์๊ฐ์ ์ ์ฝํ๊ธฐ ์ํด ๋ช ์ค์ ์ฝ๋๋ก ์ฌ๋ฌ ๋ถ์ ํต๊ณ๋์ ํ์ธํ ์ ์๋ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ ํ๋ ๋ฐ ์ด๋ฅผ ํ๋ค์ค ํ๋กํ์ผ๋ง(Pandas-Profiling) ์ด๋ผ๊ณ ํ๋ค. pip ๋ช ๋ น์ ํตํด ํจํค์ง ์ค์น pip install -U pandas-profiling ๋ฐ์ดํฐ ๋ก๋ํ๊ธฐ im.. 2022. 8. 5. [python/ํ์ด์ฌ] Matplotlib (3) - ๋ฐ์ค ํ๋กฏ(box plot), ํ์คํ ๊ทธ๋จ, ํ์ด ์ฐจํธ(Pie chart), 3์ฐจ์ ํ๋กํ Matplotlib ๋ฐ์ค ํ๋กฏ(box plot) ax.boxplot() ์์น ๋ฐ์ดํฐ๋ฅผ ํํํ๋ ํ๋์ ๋ฐฉ์ ์ผ๋ฐ์ ์ผ๋ก ๋ฐ์ค ํ๋กฏ์ ์ ์ฒด ๋ฐ์ดํฐ๋ก๋ถํฐ ์ป์ด์ง ๋ค์ฏ ๊ฐ์ง ์์ฝ ์์น๋ฅผ ์ฌ์ฉํด์ ๊ทธ๋ฆผ ์ต์๊ฐ ์ 1์ฌ๋ถ์ ์(Q1) ์ 2์ฌ๋ถ์ ์ ๋๋ ์ค์์(Q2) ์ 3์ฌ๋ถ์ ์(Q3) ์ต๋๊ฐ import matplotlib.pyplot as plt import seaborn as sns sns.set(rc={'figure.figsize':(10, 5)}) import pandas as pd # ๋ฐ์ดํฐ ์ค๋น r1 = np.random.normal(loc=0, scale=0.5, size=100) r2 = np.random.normal(loc=0.5, scale=1, size=100) r3 = np.random.. 2022. 8. 4. ์ด์ 1 2 3 4 5 6 7 ยทยทยท 9 ๋ค์