분류 전체보기(60)
-
[Numpy Built-in Functions]
evenly spaced values within a given interval : np.arange() np.arange(start = 0, end = 1.01, step = 0.01) # ==> returns 0 부터 1.01까지 0.01의 간격으로 다 반환 random sample from 1-D array : np.random.choice() a = [1,2,3,4,5] np.random.choice(a,size=3) # ==> 'a'라는 1-D array의 element중에서 random하게 3개 추출 concatenate arrays : np.concatenate() a = np.array([[1,2,3,4,5]]) b = np.array([[6,7,8,9,10]]) # by r..
2021.01.12 -
[Statistics] Useful Tips
[binomical distribution] # 1 나올 확률이 0.5인 사건을 500번 돌린 후 mean return np.random.binomial(n=1, p=0.5, size = 500) [t-test] coin1 = np.random.binomial(n=1, p=0.5, size = 500) coin2 = np.random.binomial(n=1, p = 0.6, size = 1000) # Two-side test # one sample t-test stats.ttest_1samp(coin1,0.5) # ==> mean == 0.5 vs mean != 0.5 # two sample t-test stats.ttest_ind(coin1,coin2) # ==> mean1 == mean2 vs mea..
2021.01.06 -
[Pandas] Useful Tips
[Slicing index of a specific column data] man_index = df[df['gender']=='man'].index.tolist() # 'gender' column 안에 'man'이라는 특정 data 전체 index를 list로 반환 [loc + groupby + count 응용] # ex1 man_survival = df.loc[man_index].groupby('survived').gender.count() # man_index 중 survived=0 과 survived=1 별로 count를 반환 # 이 때 man_survival이 list(?) 형식으로 표현되는 것 같음 # man_survival[0]은 man 중 survived=0 총 갯수 # man_surviv..
2021.01.02 -
[Visualization] - 유용한 TIP 정리
[warning 안 뜨게 하는 방법] import warnings warnings.filterwarnings("ignore") [데이터 시각화 할 때 한글 폰트 안 나온다면..?] !sudo apt-get install -y fonts-nanum !sudo fc-cache -fv !rm ~/.cache/matplotlib -rf 입력 후 엔터! 그리고 '런타임 다시 시작' 후 import matplotlib.pyplot as plt plt.rc('font', family='NanumGothic') # 기타 nanum font 써도 됨 하면 정상적으로 나오더라~ [Matplotlib] [Types] #matplotlib 정리 (수동) # errorbar plt.e..
2020.12.30 -
[Pandas Built-in Functions]
view small sample : head() & tail() # default로 처음 5개 row 출력 or head(n)로 처음 n 개 row 출력 df.head() # default로 마지막 5개 row 출력 or tail(n)로 마지막 n 개 row 출력 df.tail() view NaN : isnull() # 모든 데이터 값 중 NaN이 있으면 True, 아니면 False 반환 df.isnull() # 각 column의 NaN 개수의 합 반환 df.isnull().sum() replace NaN : fillna() # NaN값을 n으로 대체 df.fillna(n) # NaN값을 0으로 대체 df.fillna(0) : locate row : iloc[][] # specific row + spec..
2020.12.29 -
[Questions]Data Preprocess & EDA
[쉼표가 있는데 csv로 정상적으로 읽힌 이유는 무엇일까요?] (O) Data Type이 'Object'인지 확인해 볼 것! df.types : 각 column의 data type 반환 [Pairplot] (X) 좀 더 조사해볼 것 [csv 파일 불러올 때 Unicode-Error 발생 시] (O) encoding 인자에 한글 전용 인코딩 방식 'euc-kr' 또는 'cp949' 쓰면 됨! df = pd.read_csv('file.csv', encoding= 'cp949' [melt개념] (O) import seaborn as sns df a b c a1 b1 c1 ==> melt.(id_vars = 'a', var_n..
2020.12.29