본문 바로가기

study/인공지능

[데이콘 스터디] 4주차_함수 정리

describe() --> 다양한 통계량을 요약해주는 함수
통계량은 Series에 대해 요약이 수행됨
DataFrame의 경우 열에 대해 요약 수행
기본적으로 Nan과 같은 결측데이터는 제외하고 수행됨

train.describe() 

https://kongdols-room.tistory.com/172

plt.rcParams['axes.unicode_minus'] = False
#그래프에서 마이너스 기호가 깨지지 않고 표시되도록

http://hleecaster.com/python-seaborn-violinplot/

vilolinplot -> KDE plot + box plot

https://laziness.xyz/2018/05/Python-Percentile

percentile : 백분위수

  • 크기가 있는 값들을 순서대로 나열했을 때 백분율로 나타낸 특정 위치의 값
  • 1사분위 수 = 25% 백분위 수
#따라서 numpy의 percentile을 이용해 데이터가 차지하는 비율을 확인
#percentile -> 백분위수
percentage_99 = np.percentile(train["amount"], 99) #99%
percentage_98 = np.percentile(train["amount"], 98) #98%

https://dsbook.tistory.com/51

Heatmap : 데이터들의 배열을 색상으로 표현해주는 그래프

  • sns.heatmap(df, vmin, vmax, cbar, center, linewidths, annot, cmap)
  • vmin, vmax : 색으로 표현하는 값의 최솟값과 최댓값
  • cbar : colorbar의 유무
  • center : 중앙값 설정
  • linewidths : 각 cell 사이마다 선을 넣어주고 그 선의 굵기를 결정
  • annot : 각 cell 값 표기 유무
  • cmap : colormap
#상관계수
plt.figure(figsize = (10, 10)) #그래프? 의 크기가 바뀐다
sns.heatmap(train[train.columns].corr(), cmap = "RdBu_r", annot = True)

https://wikidocs.net/42824

countplot
: 범주형 변수의 빈도수를 시각화


https://seaborn.pydata.org/generated/seaborn.countplot.html

https://m.blog.naver.com/PostView.nhn?blogId=heygun&logNo=221520454294&proxyReferer=https:%2F%2Fwww.google.com%2F

figure, ax = plt.subplots()

  • figure : 전체 subplot을 말한다.
  • ax는 axe : 전체 중 낱낱개를 말한다
  • subplot은 하나의 값(axes)만 받을 수 있다.

https://kongdols-room.tistory.com/106

DataFrame.from_dict() --> 딕셔너리를 입력으로 가진다.

  • orient라는 입력 변수 columns(키를 열의 레이블/default)/index(키를 행의 레이블)